1
0

feat: rewrite to more nixy flakes

This commit is contained in:
2026-03-10 17:41:28 +01:00
parent 2c8cf957ee
commit d41abb956a
36 changed files with 1610 additions and 779 deletions
-1
View File
@@ -1,2 +1 @@
.env.nix
hardware-configuration.nix
+39 -26
View File
@@ -1,12 +1,39 @@
{
config,
pkgs,
lib ? pkgs.lib,
...
}:
let
concat = strings: builtins.concatStringsSep " " strings;
displays =
let
primary = "DP-2";
secondary = "HDMI-0";
in
{
inherit primary secondary;
xrandr = concat [
"--output ${primary}"
"--mode 1920x1080"
"--pos 0x0"
"--rate 144"
"--primary"
""
"--output ${secondary}"
"--mode 1920x1080"
"--pos 1920x0"
"--rate 144"
];
};
in
{
inherit displays;
nixosModule =
{
pkgs,
config,
lib ? pkgs.lib,
...
}:
let
wacom.src =
let
xsetwacom = "${pkgs.xf86_input_wacom}/bin/xsetwacom";
@@ -42,8 +69,10 @@ let
${xsetwacom} set "$stylus" MapToOutput HEAD-0
'';
in
{
in
{
services.xserver.videoDrivers = [ "nvidia" ];
services.xserver.wacom.enable = true;
@@ -57,23 +86,6 @@ in
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
home-manager.users.anton.xsession.profileExtra = concat [
"${lib.getExe pkgs.xrandr}"
"${concat [
"--output DP-2"
"--mode 1920x1080"
"--pos 0x0"
"--rate 144"
"--primary"
]}"
"${concat [
"--output HDMI-0"
"--mode 1920x1080"
"--pos 1920x0"
"--rate 144"
]}"
];
systemd.user.services.wacom = {
enable = true;
description = "Configure my Wacom (One) tablet";
@@ -88,4 +100,5 @@ in
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="056a", TAG+="systemd", ENV{SYSTEMD_USER_WANTS}+="wacom.service"
'';
};
}
+33 -66
View File
@@ -2,31 +2,20 @@
config,
pkgs,
lib,
hostname,
env,
...
}:
let
stateVersion = "25.05";
env = import ./.env.nix { inherit pkgs; };
mpkgs = import ./pkgs/default.nix {
config = {
system.stateVersion = stateVersion;
};
};
in
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
(import (./. + "/${env.hostname}.nix"))
mpkgs.home-manager.module
];
imports = [ ./hardware-configuration.nix ] ++ lib.optional (env ? nixosModule) env.nixosModule;
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [
(import "${fetchTarball "https://github.com/nix-community/fenix/archive/main.tar.gz"}/overlay.nix")
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
chromium
@@ -43,17 +32,10 @@ in
fzf
ripgrep
(fenix.stable.withComponents [
"rustc"
"cargo"
"clippy"
"rust-src"
"rustfmt"
"rust-analyzer"
])
# perhaps set up lsps through dev shells someday?
nodejs_latest
prettierd
typescript-language-server
prettierd
pnpm
nixd
nixfmt
@@ -70,8 +52,8 @@ in
jetbrains-mono
nerd-fonts.symbols-only
inter
times-newer-roman
(mpkgs.font.monaco)
nimbus-roman
monaco
];
fonts.fontconfig = {
@@ -87,7 +69,7 @@ in
"Inter"
"Noto Sans"
];
serif = [ "Times Newer Roman" ];
serif = [ "Nimbus Roman" ];
};
};
@@ -97,16 +79,13 @@ in
windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
rofi
i3status
];
};
displayManager.startx.enable = true;
# Configure keymap in X11
xkb = {
layout = "us";
variant = "";
@@ -118,8 +97,7 @@ in
greetd = {
enable = true;
restart = false;
settings = {
default_session = {
settings.default_session = {
command = lib.concatStringsSep " " [
"${lib.getExe pkgs.tuigreet}"
"--remember"
@@ -130,7 +108,6 @@ in
};
};
};
};
programs.chromium = import ./home/chromium.nix;
@@ -153,14 +130,6 @@ in
];
};
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
sharedModules = [ ] ++ (mpkgs.home-manager.sharedModules);
users.anton = import ./home.nix;
};
# programs.home-manager.enable = true;
programs.dconf.enable = true;
qt = {
enable = true;
@@ -168,26 +137,25 @@ in
style = "adwaita-dark";
};
hardware.graphics = {
hardware = {
graphics = {
enable = true;
extraPackages = with pkgs; [
extraPackages = with pkgs.unstable; [
intel-media-driver
intel-vaapi-driver
libvdpau-va-gl
mesa
(pkgs.mesa)
];
};
hardware.bluetooth = {
bluetooth = {
enable = true;
powerOnBoot = true;
settings = {
General = {
settings.General = {
Experimental = true;
FastConnectable = true;
};
Policy.AutoEnable = true;
settings.Policy.AutoEnable = true;
};
};
@@ -198,26 +166,27 @@ in
services.gnome.gnome-keyring.enable = true;
# Bootloader.
boot.loader.systemd-boot = {
boot = {
loader.systemd-boot = {
enable = true;
configurationLimit = 10;
};
boot.loader.efi.canTouchEfiVariables = true;
loader.efi.canTouchEfiVariables = true;
boot.kernelParams = [ "console=tty1" ];
kernelParams = [ "console=tty1" ];
kernelPackages = pkgs.unstable.linuxPackages_latest;
};
boot.kernelPackages = pkgs.linuxPackages_latest;
networking = {
hostName = hostname;
networking.hostName = env.hostname;
networking.firewall.enable = false;
networking.networkmanager.enable = true;
firewall.enable = false;
networkmanager.enable = true;
};
time.timeZone = "Europe/Stockholm";
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "sv_SE.UTF-8";
LC_IDENTIFICATION = "sv_SE.UTF-8";
@@ -230,13 +199,11 @@ in
LC_TIME = "sv_SE.UTF-8";
};
nix.settings.extra-experimental-features = [ "nix-command" ];
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = stateVersion; # Did you read the comment?
system.stateVersion = "25.05"; # Did you read the comment?
}
Generated
+118
View File
@@ -0,0 +1,118 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1772985280,
"narHash": "sha256-FdrNykOoY9VStevU4zjSUdvsL9SzJTcXt4omdEDZDLk=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "8f736f007139d7f70752657dff6a401a585d6cbc",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-25.11",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1772822230,
"narHash": "sha256-yf3iYLGbGVlIthlQIk5/4/EQDZNNEmuqKZkQssMljuw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "71caefce12ba78d84fe618cf61644dce01cf3a96",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-25.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1772963539,
"narHash": "sha256-9jVDGZnvCckTGdYT53d/EfznygLskyLQXYwJLKMPsZs=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9dcb002ca1690658be4a04645215baea8b95f31d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1772963539,
"narHash": "sha256-9jVDGZnvCckTGdYT53d/EfznygLskyLQXYwJLKMPsZs=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9dcb002ca1690658be4a04645215baea8b95f31d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"overlay": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"path": "./pkgs",
"type": "path"
},
"original": {
"path": "./pkgs",
"type": "path"
},
"parent": []
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable",
"overlay": "overlay",
"sops-nix": "sops-nix"
}
},
"sops-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1773096132,
"narHash": "sha256-M3zEnq9OElB7zqc+mjgPlByPm1O5t2fbUrH3t/Hm5Ag=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "d1ff3b1034d5bab5d7d8086a7803c5a5968cd784",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "sops-nix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
+70
View File
@@ -0,0 +1,70 @@
{
description = "System configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager/release-25.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
overlay.url = "path:./pkgs";
};
outputs =
{
self,
nixpkgs,
nixpkgs-unstable,
home-manager,
sops-nix,
overlay,
}@inputs:
let
systems = [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
hostname = "blueplum";
env = import ./${hostname}.nix;
in
{
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt);
nixosConfigurations.blueplum = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs hostname env; };
modules = [
{
nixpkgs.overlays = [
overlay.overlays.default
(final: prev: {
unstable = import nixpkgs-unstable {
inherit (final) config;
inherit (final.stdenv.hostPlatform) system;
};
})
];
}
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.anton = import ./home.nix;
sharedModules = import ./modules;
extraSpecialArgs = { inherit hostname env; };
};
}
sops-nix.nixosModules.sops
];
};
};
}
+43
View File
@@ -0,0 +1,43 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/2a269992-8aaa-4600-99b7-9020e8cd8cfc";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/D622-8FDF";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
fileSystems."/home/anton/mnt/sda" =
{ device = "/dev/disk/by-uuid/735e9ebf-71f7-49ce-a2d7-5e62a8820f2a";
fsType = "ext4";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+40 -36
View File
@@ -1,19 +1,21 @@
{
pkgs,
lib ? pkgs.lib,
lib,
env,
...
}:
let
mpkgs = import ./pkgs/default.nix { };
inherit (mpkgs.config) neovim fish;
env = import ./.env.nix { inherit pkgs; };
# env = import ./.env.nix { inherit pkgs; };
home = /home/anton;
in
{
imports = [ ];
imports = [
./home/vesktop.nix
./home/kitty.nix
./home/i3.nix
]
++ lib.optional (env ? homeManager) env.homeManager;
home.username = lib.mkDefault "anton";
home.homeDirectory = lib.mkDefault home;
@@ -27,7 +29,6 @@ in
vscode
godotPackages_4_5.godot
neovim
btop
xclip
tree
@@ -36,9 +37,6 @@ in
hyperfine
bat
typst
tinymist
# required by spotify
ffmpeg_4
];
@@ -51,23 +49,25 @@ in
package = pkgs.posy-cursors;
};
xsession = {
enable = true;
windowManager.i3 = import ./home/i3.nix { inherit pkgs; };
};
programs.btop.enable = true;
programs.fastfetch.enable = true;
programs.kitty = import ./home/kitty.nix { inherit pkgs; };
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
programs.fish = {
programs.fish =
let
config = pkgs.configs.fish;
in
{
enable = true;
shellInit = ''
set fish_function_path $fish_function_path ${fish}/functions
set fish_function_path $fish_function_path ${config}/functions
'';
interactiveShellInit = ''
source ${fish}/config.fish
source ${config}/config.fish
'';
};
@@ -77,9 +77,13 @@ in
programs.neovim = {
enable = true;
defaultEditor = true;
extraConfig = ''
set runtimepath+=${neovim}
source ${neovim}/init.lua
extraConfig =
let
config = pkgs.configs.neovim;
in
''
set runtimepath+=${config}
source ${config}/init.lua
'';
};
@@ -92,14 +96,14 @@ in
programs.git = {
enable = true;
signing =
if (env.git or { }) ? signingKey then
{
key = env.git.signingKey;
signByDefault = true;
}
else
{ signByDefault = false; };
# signing =
# if (env.git or { }) ? signingKey then
# {
# key = env.git.signingKey;
# signByDefault = true;
# }
# else
# { signByDefault = false; };
settings = {
user.name = "Anton";
@@ -135,12 +139,12 @@ in
programs.tetrio-desktop = {
enable = true;
package = mpkgs.tetrio.desktop;
package = pkgs.tetrio.desktop;
plus = {
enable = true;
package = mpkgs.tetrio.plus;
skin.package = mpkgs.tetrio.skins.simple-connected;
package = pkgs.tetrio.plus;
skin.package = pkgs.tetrio.skins.simple-connected;
};
settings = {
@@ -193,7 +197,7 @@ in
};
};
programs.vesktop = import ./home/vesktop.nix;
# programs.vesktop = pkgs.callPackage { };
services.gpg-agent = {
enable = true;
@@ -217,5 +221,5 @@ in
NIXPKGS_ALLOW_UNFREE = 1;
};
home.stateVersion = mpkgs.system.stateVersion;
home.stateVersion = "25.11";
}
+13 -18
View File
@@ -1,17 +1,16 @@
{
pkgs,
lib ? pkgs.lib,
lib,
env,
...
}:
let
mod = "Mod4";
wallpaper = pkgs.callPackage ../pkgs/wallpaper/default.nix { };
env = import /etc/nixos/.env.nix { inherit pkgs; };
displays = if env ? displays then env.displays else null;
in
{
xsession.windowManager.i3 = {
enable = true;
config = {
@@ -69,7 +68,7 @@ in
"--"
(lib.concatStringsSep " " [
(lib.getExe pkgs.mpv)
"${wallpaper}/wallpaper.mov"
"${pkgs.wallpaper}/wallpaper.mov"
"-wid WID"
"--loop"
"--no-audio"
@@ -83,24 +82,20 @@ in
"--hwdec=auto"
])
];
displays =
if (env ? displays) then
displayConf =
if displays != null then
lib.concatStringsSep "\n" [
"workspace 1 output ${env.displays.primary}"
(if (env.displays ? secondary) then "workspace 2 output ${env.displays.secondary}" else "")
"exec i3-msg focus output ${env.displays.primary}"
(
if (env.displays ? xrandr) then
"exec \"${lib.getExe pkgs.xrandr} ${env.displays.xrandr}\""
else
""
)
"workspace 1 output ${displays.primary}"
(if (displays ? secondary) then "workspace 2 output ${displays.secondary}" else "")
"exec i3-msg focus output ${displays.primary}"
(if (displays ? xrandr) then "exec \"${lib.getExe pkgs.xrandr} ${displays.xrandr}\"" else "")
]
else
"";
in
lib.concatStringsSep "\n" [
background
displays
displayConf
];
};
}
+46 -36
View File
@@ -1,49 +1,59 @@
{ pkgs, ... }:
{
pkgs,
lib,
...
}:
let
makeTheme =
attrs: builtins.concatStringsSep "\n" (lib.mapAttrsToList (k: v: "${k} ${toString v}") attrs);
in
{
programs.kitty = {
enable = true;
font = {
package = pkgs.jetbrains-mono;
name = "JetBrains Mono";
size = 13;
};
extraConfig = ''
foreground #f2f4f8
background #161616
selection_foreground #f2f4f8
selection_background #2a2a2a
extraConfig = makeTheme {
foreground = "#f2f4f8";
background = "#161616";
selection_foreground = "#f2f4f8";
selection_background = "#2a2a2a";
cursor #f2f4f8
cursor_text_color #161616
cursor = "#f2f4f8";
cursor_text_color = "#161616";
url_color #25be6a
url_color = "#25be6a";
active_border_color #78a9ff
inactive_border_color #535353
bell_border_color #3ddbd9
active_border_color = "#78a9ff";
inactive_border_color = "#535353";
bell_border_color = "#3ddbd9";
active_tab_foreground #0c0c0c
active_tab_background #78a9ff
inactive_tab_foreground #6e6f70
inactive_tab_background #2a2a2a
active_tab_foreground = "#0c0c0c";
active_tab_background = "#78a9ff";
inactive_tab_foreground = "#6e6f70";
inactive_tab_background = "#2a2a2a";
color0 #282828
color8 #484848
color1 #ee5396
color9 #f16da6
color2 #25be6a
color10 #46c880
color3 #ebcb8b
color11 #f0d399
color4 #78a9ff
color12 #8cb6ff
color5 #be95ff
color13 #c8a5ff
color6 #33b1ff
color14 #52bdff
color7 #dfdfe0
color15 #e4e4e5
color16 #3ddbd9
color17 #ff7eb6
'';
color0 = "#282828";
color8 = "#484848";
color1 = "#ee5396";
color9 = "#f16da6";
color2 = "#25be6a";
color10 = "#46c880";
color3 = "#ebcb8b";
color11 = "#f0d399";
color4 = "#78a9ff";
color12 = "#8cb6ff";
color5 = "#be95ff";
color13 = "#c8a5ff";
color6 = "#33b1ff";
color14 = "#52bdff";
color7 = "#dfdfe0";
color15 = "#e4e4e5";
color16 = "#3ddbd9";
color17 = "#ff7eb6";
};
};
}
+16 -1
View File
@@ -1,6 +1,21 @@
{ lib, ... }:
{
pkgs,
configs ? pkgs.configs,
...
}:
{
programs.neovim = {
enable = true;
defaultEditor = true;
extraConfig =
let
config = configs.neovim;
in
''
set runtimepath+=${config}
source ${config}/init.lua
'';
};
}
+4
View File
@@ -1,4 +1,7 @@
{ ... }:
{
programs.vesktop = {
enable = true;
settings = {
discordBranch = "stable";
@@ -313,4 +316,5 @@
WebContextMenus.enabled = true;
};
};
};
}
+4
View File
@@ -0,0 +1,4 @@
[
./tetrio
./initialFile.nix
]
+172
View File
@@ -0,0 +1,172 @@
{
pkgs,
lib ? pkgs.lib,
config,
...
}:
let
inherit (lib) mkOption types;
cfg = lib.filterAttrs (n: f: f.enable) config.home.initialFile;
home = config.home.homeDirectory;
in
{
options = {
home.initialFile = mkOption {
type = types.attrsOf (
types.submodule (
{ name, config, ... }:
{
options = {
enable = mkOption {
type = types.bool;
default = true;
};
target = mkOption {
type = types.str;
apply =
path:
let
absPath = if lib.hasPrefix "/" path then path else "${home}/${path}";
in
lib.removePrefix (home + "/") absPath;
description = "Path to target file relative to home directory";
default = "/homeless-shelter/home";
};
text = mkOption {
type = types.nullOr types.lines;
description = "Text of the file, otherwise copies .source file.";
default = null;
};
source = mkOption {
type = types.path;
description = "Path of file whose source to copy";
};
mode = mkOption {
type = types.nullOr types.str;
description = "File mode to apply to target file (sourced from .source / .text if not specified)";
default = null;
};
dir_mode = mkOption {
type = types.str;
description = "File mode to apply to directories";
default = "0755";
};
recursive = mkOption {
type = types.bool;
description = "Whether or not to recursively copy .source as a directory instead of as a file";
default = false;
};
force = mkOption {
type = types.bool;
description = "Whether to unconditionally replace the target file, even if it already exists.";
default = false;
};
};
config = {
target = lib.mkDefault name;
source = lib.mkIf (config.text != null) (
lib.mkDefault (
pkgs.writeTextFile {
inherit (config) text;
name = lib.hm.strings.storeFileName name;
}
)
);
};
}
)
);
description = "Attribute set of files to write into the user home (if they don't already exist).";
default = { };
};
};
config = {
assertions = [
(
let
dups = lib.attrNames (
lib.filterAttrs (n: v: v > 1) (
lib.foldAttrs (acc: v: acc + v) 0 (lib.mapAttrsToList (n: v: { ${v.target} = 1; }) cfg)
)
);
dupsStr = lib.concatStringsSep ", " dups;
in
{
assertion = dups == [ ];
message = ''
Conflicting managed target files: ${dupsStr}
This may happen, for example, if you have a configuration similar to
home.initialFile = {
conflict1 = { source = ./foo.nix; target = "baz"; };
conflict2 = { source = ./bar.nix; target = "baz"; };
}'';
}
)
];
home.activation.copyInitialFiles = lib.hm.dag.entryAfter [ "writeBoundary" ] (
let
homeArg = lib.escapeShellArg home;
in
''
function copyFile() {
local source="$1"
local targetRel="$2"
local mode="$3"
local dirMode="$4"
local recursive="$5"
local force="$6"
local target="${homeArg}/$targetRel"
if [[ -e "$target" && "$force" != "true" ]]; then
verboseEcho "Skipping existing $target"
return 0
fi
run mkdir -p "$(dirname "$target")"
if [[ -d "$source" ]]; then
if [[ "$recursive" != "true" ]]; then
errorEcho "Source '$source' is a directory but recursive=false"
return 1
fi
run rm -rf "$target"
run cp -r "$source" "$target"
else
if [[ -e "$target" && "$force" == "true" ]]; then
run rm -f "$target"
fi
run cp "$source" "$target"
fi
if [[ -n "$mode" ]]; then
if [[ -d "$target" && "$recursive" == "true" ]]; then
run chmod "$dirMode" "$target"
find "$target" -type f -exec chmod "$mode" {} +
else
run chmod "$mode" "$target"
fi
fi
}
''
+ lib.concatMapStrings (
v:
let
src = lib.escapeShellArg (toString v.source);
tgt = lib.escapeShellArg v.target;
mode = if v.mode == null then "''" else lib.escapeShellArg v.mode;
in
''
copyFile ${src} ${tgt} ${mode} ${lib.escapeShellArg v.dir_mode} ${lib.trivial.boolToString v.recursive} ${lib.trivial.boolToString v.force}
''
) (lib.attrValues cfg)
);
};
}
File diff suppressed because it is too large Load Diff
+32
View File
@@ -0,0 +1,32 @@
{
stdenv,
lib,
leveldb-cli,
value,
origin ? "https://tetr.io",
key ? "userConfig",
}:
let
src = ./.;
in
stdenv.mkDerivation {
pname = "tetrio-leveldb";
version = "1";
inherit src;
nativeBuildInputs = [ leveldb-cli ];
buildPhase = ''
runHook preBuild
${lib.getExe leveldb-cli} \
$out \
${lib.escapeShellArg origin} \
${lib.escapeShellArg key} \
${lib.escapeShellArg (builtins.toJSON value)}
runHook postBuild
'';
}
+11 -35
View File
@@ -1,32 +1,22 @@
{
pkgs ? import <nixpkgs> { config.allowUnfree = true; },
config ? (import <nixpkgs/nixos> { }).config,
fetchzip ? pkgs.fetchzip,
...
}:
final: prev:
let
system = {
stateVersion = config.system.stateVersion;
};
use = path: pkgs.callPackage (import path) { inherit pkgs; };
fetchzip = prev.fetchzip;
use = path: prev.callPackage (import path) { pkgs = prev; };
in
{
inherit system;
wallpaper = use ./wallpaper/default.nix;
tetrio.desktop = use ./tetrio/default.nix;
wallpaper = use ./wallpaper;
tetrio.desktop = use ./tetrio;
tetrio.plus =
let
repo = {
owner = "UniQMG";
name = "tetrio-plus";
job = "11675178434";
hash = "sha256-j3ACcnT64eMQtWYDGOE2oGXpnN5EUqk+lyV6ARBEtU8=";
};
src = fetchzip {
url = "https://gitlab.com/${repo.owner}/${repo.name}/-/jobs/${repo.job}/artifacts/raw/app.asar.zip";
hash = repo.hash;
hash = "sha256-j3ACcnT64eMQtWYDGOE2oGXpnN5EUqk+lyV6ARBEtU8=";
};
in
"${src}/app.asar";
@@ -34,25 +24,11 @@ in
simple-connected = use ./tetrio/skins/simple-connected.nix;
};
leveldb-cli = use ./leveldb/default.nix;
leveldb-cli = use ./leveldb;
config.neovim = use ./neovim/default.nix;
config.fish = use ./fish/default.nix;
configs.neovim = use ./neovim;
configs.fish = use ./fish;
font.monaco = use ./monaco-font/default.nix;
home-manager = {
module =
let
home-manager = fetchzip {
url = "https://github.com/nix-community/home-manager/archive/master.tar.gz";
hash = "sha256-UZjPc/d5XRxvjDbk4veAO4XFdvx6BUum2l40V688Xq8=";
};
in
import "${home-manager}/nixos";
sharedModules = [
./home-manager/initialFile.nix
./tetrio/module.nix
];
};
nimbus-roman = use ./nimbus;
monaco = use ./monaco-font;
}
-180
View File
@@ -1,180 +0,0 @@
{
lib,
stdenv,
fetchFromGitHub,
makeWrapper,
makeDesktopItem,
nodejs,
electron_39,
element-web,
sqlcipher,
callPackage,
typescript,
# command line arguments which are always set
commandLineArgs ? "",
yarnConfigHook,
yarnBuildHook,
fetchYarnDeps,
asar,
copyDesktopItems,
darwin,
...
}:
let
pinData = import ./element-desktop-pin.nix;
inherit (pinData.hashes) desktopSrcHash desktopYarnHash;
executableName = "element-desktop";
electron = electron_39;
seshat = callPackage ./seshat { };
in
stdenv.mkDerivation (
finalAttrs:
removeAttrs pinData [ "hashes" ]
// {
pname = "element-desktop";
name = "${finalAttrs.pname}-${finalAttrs.version}";
src = fetchFromGitHub {
owner = "element-hq";
repo = "element-desktop";
rev = "v${finalAttrs.version}";
hash = desktopSrcHash;
};
offlineCache = fetchYarnDeps {
yarnLock = finalAttrs.src + "/yarn.lock";
hash = desktopYarnHash;
};
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
nativeBuildInputs = [
asar
copyDesktopItems
nodejs
makeWrapper
typescript
yarnConfigHook
yarnBuildHook
]
++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.autoSignDarwinBinariesHook ];
inherit seshat;
# Only affects unused scripts in $out/share/element/electron/scripts. Also
# breaks because there are some `node`-scripts with a `npx`-shebang and
# this shouldn't be in the closure just for unused scripts.
dontPatchShebangs = true;
postPatch = ''
cp -r ${electron.dist} electron-dist
chmod -R u+w electron-dist
substituteInPlace package.json \
--replace-fail \
' electron-builder",' \
' electron-builder --dir -c.electronDist=electron-dist -c.electronVersion=${electron.version} -c.mac.identity=null",'
# `@electron/fuses` tries to run `codesign` and fails. Disable and use autoSignDarwinBinariesHook instead
substituteInPlace ./electron-builder.ts \
--replace-fail "resetAdHocDarwinSignature:" "// resetAdHocDarwinSignature:"
# Need to disable asar integrity check to copy in native seshat files, see postBuild phase
substituteInPlace ./electron-builder.ts \
--replace-fail "enableEmbeddedAsarIntegrityValidation: true" "enableEmbeddedAsarIntegrityValidation: false"
'';
preBuild = ''
# Apply upstream patch
# Can be removed if upstream removes patches/@types+auto-launch+5.0.5.patch introduced in
# https://github.com/element-hq/element-desktop/commit/5e882f8e08d58bf9663c8e3ab33885bf7b3709de
node ./node_modules/patch-package/index.js
'';
postBuild = ''
# relative path to app.asar differs on Linux and MacOS
packed=$(find ./dist -name app.asar)
asar extract "$packed" tmp-app
# linking here leads to Error: tmp-app/node_modules/matrix-seshat: file ... links out of the package
cp -r $seshat tmp-app/node_modules/matrix-seshat
asar pack tmp-app "$packed"
'';
installPhase = ''
runHook preInstall
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$out/Applications" "$out/bin"
mv dist/mac*/Element.app "$out/Applications"
ln -s '${element-web}' "$out/Applications/Element.app/Contents/Resources/webapp"
wrapProgram "$out/Applications/Element.app/Contents/MacOS/Element" \
--add-flags ${lib.escapeShellArg commandLineArgs}
makeWrapper "$out/Applications/Element.app/Contents/MacOS/Element" "$out/bin/${executableName}"
''
+ lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
mkdir -p "$out/bin" "$out/share"
cp -a dist/*-unpacked/resources $out/share/element
ln -s '${element-web}' "$out/share/element/webapp"
# icon, used in makeDesktopItem
mkdir -p "$out/share/icons/hicolor/512x512/apps"
ln -s "$out/share/element/build/icon.png" "$out/share/icons/hicolor/512x512/apps/element.png"
# executable wrapper
# LD_PRELOAD workaround for sqlcipher not found: https://github.com/matrix-org/seshat/issues/102
makeWrapper '${lib.getExe electron}' "$out/bin/${executableName}" \
--set LD_PRELOAD ${sqlcipher}/lib/libsqlcipher.so \
--add-flags "$out/share/element/app.asar" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
--add-flags ${lib.escapeShellArg commandLineArgs}
''
+ ''
runHook postInstall
'';
# The desktop item properties should be kept in sync with data from upstream:
# https://github.com/element-hq/element-desktop/blob/develop/package.json
desktopItems = [
(makeDesktopItem {
name = "element-desktop";
exec = "${executableName} %u";
icon = "element";
desktopName = "Element";
genericName = "Matrix Client";
comment = finalAttrs.meta.description;
categories = [
"Network"
"InstantMessaging"
"Chat"
];
startupWMClass = "Element";
mimeTypes = [
"x-scheme-handler/element"
"x-scheme-handler/io.element.desktop"
];
})
];
passthru = {
# run with: nix-shell ./maintainers/scripts/update.nix --argstr package element-desktop
updateScript = ./update.sh;
};
meta = {
description = "Feature-rich client for Matrix.org";
homepage = "https://element.io/";
changelog = "https://github.com/element-hq/element-desktop/blob/v${finalAttrs.version}/CHANGELOG.md";
license = lib.licenses.agpl3Plus;
teams = [ lib.teams.matrix ];
inherit (electron.meta) platforms;
mainProgram = "element-desktop";
};
}
)
-7
View File
@@ -1,7 +0,0 @@
{
"version" = "1.12.10";
"hashes" = {
"desktopSrcHash" = "sha256-2LQBT3+2JTR3XHO3DynOp8cw2m2SB/mGH01e3SFD/IM=";
"desktopYarnHash" = "sha256-QIzuVKmUS4tqXAzhpfLZOp51kLbfC1M2nrff8e+sdg4=";
};
}
-74
View File
@@ -1,74 +0,0 @@
{
lib,
stdenv,
rustPlatform,
fetchFromGitHub,
sqlcipher,
nodejs,
python3,
yarn,
fixup-yarn-lock,
fetchYarnDeps,
removeReferencesTo,
}:
let
pinData = lib.importJSON ./pin.json;
in
rustPlatform.buildRustPackage rec {
pname = "seshat-node";
inherit (pinData) version cargoHash;
src = fetchFromGitHub {
owner = "matrix-org";
repo = "seshat";
rev = version;
hash = pinData.srcHash;
};
sourceRoot = "${src.name}/seshat-node/native";
nativeBuildInputs = [
nodejs
python3
yarn
fixup-yarn-lock
];
buildInputs = [ sqlcipher ];
npm_config_nodedir = nodejs;
yarnOfflineCache = fetchYarnDeps {
yarnLock = src + "/seshat-node/yarn.lock";
sha256 = pinData.yarnHash;
};
buildPhase = ''
runHook preBuild
cd ..
chmod u+w . ./yarn.lock
export HOME=$PWD/tmp
mkdir -p $HOME
yarn config --offline set yarn-offline-mirror $yarnOfflineCache
fixup-yarn-lock yarn.lock
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
patchShebangs node_modules/
node_modules/.bin/neon build --release -- --target ${stdenv.hostPlatform.rust.rustcTarget} -Z unstable-options --out-dir target/release
runHook postBuild
'';
doCheck = false;
installPhase = ''
runHook preInstall
shopt -s extglob
rm -rf native/!(index.node)
rm -rf node_modules $HOME
cp -r . $out
${removeReferencesTo}/bin/remove-references-to -t ${stdenv.cc.cc} $out/native/index.node
runHook postInstall
'';
disallowedReferences = [ stdenv.cc.cc ];
}
-6
View File
@@ -1,6 +0,0 @@
{
"version": "2.3.3",
"srcHash": "sha256-HmKHWFoO8TQ9S/RcJnJ3h85/2uSkqGrgLnX82hkux4Q=",
"yarnHash": "1cbkv8ap7f8vxl5brzqb86d2dyxg555sz67cldrp0vgnk8sq6ibp",
"cargoHash": "sha256-klrFk0gpqQu/9MzLEYMNqEBETZMXtZJX67Sm5ZqyHfE=="
}
-49
View File
@@ -1,49 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=../../../../../../ -i bash -p wget prefetch-yarn-deps yarn nix-prefetch nix-prefetch-github
if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
echo "Regenerates packaging data for the seshat package."
echo "Usage: $0 [git release tag]"
exit 1
fi
version="$1"
set -euo pipefail
if [ -z "$version" ]; then
version="$(wget -O- "https://api.github.com/repos/matrix-org/seshat/tags" | jq -r '.[] | .name' | sort --version-sort | tail -1)"
fi
SRC="https://raw.githubusercontent.com/matrix-org/seshat/$version"
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT
pushd $tmpdir
wget "$SRC/seshat-node/yarn.lock"
yarn_hash=$(prefetch-yarn-deps yarn.lock)
popd
src_hash=$(nix-prefetch-github matrix-org seshat --rev ${version} | jq -r .hash)
cat > pin.json << EOF
{
"version": "$version",
"srcHash": "$src_hash",
"yarnHash": "$yarn_hash",
"cargoHash": "0000000000000000000000000000000000000000000000000000"
}
EOF
cargo_hash=$(nix-prefetch "{ sha256 }: (import ../../../../../.. {}).element-desktop.seshat.cargoDeps")
cat > pin.json << EOF
{
"version": "$version",
"srcHash": "$src_hash",
"yarnHash": "$yarn_hash",
"cargoHash": "$cargo_hash"
}
EOF
+2 -6
View File
@@ -1,10 +1,6 @@
{
pkgs ? import <nixpkgs> { },
lib ? pkgs.lib,
...
}:
{ stdenv, ... }:
pkgs.stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
pname = "fish-config";
version = "1.0";
+10
View File
@@ -0,0 +1,10 @@
{
description = "Pkgs overlay";
inputs = { };
outputs =
{ self, ... }:
{
overlays.default = final: prev: (import ./default.nix final prev);
};
}
+3 -5
View File
@@ -1,12 +1,10 @@
{
pkgs ? import <nixpkgs> { },
}:
{ buildGoModule, fetchFromGitHub, ... }:
pkgs.buildGoModule {
buildGoModule {
name = "leveldb-cli";
version = "1.0.0";
src = pkgs.fetchFromGitHub {
src = fetchFromGitHub {
owner = "theblueplum";
repo = "leveldb-cli";
rev = "main";
+2 -6
View File
@@ -1,10 +1,6 @@
{
pkgs ? import <nixpkgs> { system = builtins.currentSystem; },
lib ? pkgs.lib,
...
}:
{ stdenv, lib, ... }:
pkgs.stdenv.mkDerivation rec {
stdenv.mkDerivation {
pname = "monaco-font";
version = "1.0";

Some files were not shown because too many files have changed in this diff Show More