From f84333b9a5ec12e5fb2549c8ead16f6ae0a8fb49 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 8 Mar 2024 09:06:58 +0100 Subject: [PATCH 001/218] Cosmic: init this desktop environment is still in alpha (or pre alpha) --- nix-os-configs/vm-cosmic.nix | 17 ++++++++++++ nix-os/desktop/cosmic.nix | 51 ++++++++++++++++++++++++++++++++++++ vm-cosmic.sh | 1 + 3 files changed, 69 insertions(+) create mode 100644 nix-os-configs/vm-cosmic.nix create mode 100644 nix-os/desktop/cosmic.nix create mode 100755 vm-cosmic.sh diff --git a/nix-os-configs/vm-cosmic.nix b/nix-os-configs/vm-cosmic.nix new file mode 100644 index 0000000..a7a0c4d --- /dev/null +++ b/nix-os-configs/vm-cosmic.nix @@ -0,0 +1,17 @@ +{ ... }: + +{ + imports = [ + ../nix-os/core.nix + ../nix-os/docker.nix + ../nix-os/desktop/cosmic.nix + #../nix-os/desktop/kde-plasma.nix + ../nix-os/shell.nix + ../nix-os/virtualization.nix + ../nix-os/polkit/disable-shutdown.nix + ../nix-os/locale.nix + ../nix-os/adb.nix + ../nix-os/account.nix + ../nix-os/xdg-default-apps.nix + ]; +} \ No newline at end of file diff --git a/nix-os/desktop/cosmic.nix b/nix-os/desktop/cosmic.nix new file mode 100644 index 0000000..a2ee1f5 --- /dev/null +++ b/nix-os/desktop/cosmic.nix @@ -0,0 +1,51 @@ +{pkgs, lib, ... }: + +let + nixos-cosmic = builtins.fetchGit { + url = "https://github.com/lilyinstarlight/nixos-cosmic.git"; + # rev = "c1f1dc29d6c187fd563776837ab53faafa111721"; + }; + cosmicModule = import "${nixos-cosmic}" {system = "x86_64-linux";}; + cosmicPkgsMainDir = builtins.readDir "${nixos-cosmic}/pkgs"; + cosmicPkgsDirs = builtins.filter (v: cosmicPkgsMainDir."${v}" == "directory") (builtins.attrNames cosmicPkgsMainDir); + cosmicPkgsOverlay = final: prev: builtins.listToAttrs ( + builtins.map (v: {name = v; value = final.callPackage "${nixos-cosmic}/pkgs/${v}/package.nix" {};}) cosmicPkgsDirs + ); +in +{ + imports = [ + cosmicModule + "${nixos-cosmic}/nixos/cosmic-greeter/module.nix" + "${nixos-cosmic}/nixos/cosmic/module.nix" + ]; + config = { + services.xserver.desktopManager.cosmic.enable = true; + services.xserver.displayManager.cosmic-greeter.enable = true; + nixpkgs.overlays = [ cosmicPkgsOverlay ]; + }; + options = { + cosmic-applets = lib.mkOption {default = pkgs.cosmic-applets;}; + cosmic-applibrary = lib.mkOption {default = pkgs.cosmic-applibrary;}; + cosmic-bg = lib.mkOption {default = pkgs.cosmic-bg;}; + cosmic-comp = lib.mkOption {default = pkgs.cosmic-comp;}; + cosmic-design-demo = lib.mkOption {default = pkgs.cosmic-design;}; + cosmic-edit = lib.mkOption {default = pkgs.cosmic-edit;}; + cosmic-files = lib.mkOption {default = pkgs.cosmic-files;}; + cosmic-greeter = lib.mkOption {default = pkgs.cosmic-greeter;}; + cosmic-icons = lib.mkOption {default = pkgs.cosmic-icons;}; + cosmic-launcher = lib.mkOption {default = pkgs.cosmic-launcher;}; + cosmic-notifications = lib.mkOption {default = pkgs.cosmic-notifications;}; + cosmic-osd = lib.mkOption {default = pkgs.cosmic-osd;}; + cosmic-panel = lib.mkOption {default = pkgs.cosmic-panel;}; + cosmic-protocols = lib.mkOption {default = pkgs.cosmic-protocols;}; + cosmic-randr = lib.mkOption {default = pkgs.cosmic-randr;}; + cosmic-screenshot = lib.mkOption {default = pkgs.cosmic-screenshot;}; + cosmic-session = lib.mkOption {default = pkgs.cosmic-session;}; + cosmic-settings = lib.mkOption {default = pkgs.cosmic-settings;}; + cosmic-settings-daemon = lib.mkOption {default = pkgs.cosmic-settings;}; + cosmic-term = lib.mkOption {default = pkgs.cosmic-term;}; + cosmic-workspaces-epoch = lib.mkOption {default = pkgs.cosmic-workspaces;}; + wrapCosmicAppsHook = lib.mkOption {default = pkgs.wrapCosmicAppsHook;}; + xdg-desktop-portal-cosmic = lib.mkOption {default = pkgs.xdg-desktop-portal-cosmic;}; + }; +} diff --git a/vm-cosmic.sh b/vm-cosmic.sh new file mode 100755 index 0000000..b03a0df --- /dev/null +++ b/vm-cosmic.sh @@ -0,0 +1 @@ +nix-build '' -A vm -I nixpkgs=channel:nixos-unstable -I nixos-config=./nix-os-configs/vm-cosmic.nix $@ && $(ls ./result/bin/run-*) -m 4096 && rm *.qcow2 From b79c776d974c48d7919ecf965e7230b139ca771c Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 13 Mar 2024 14:30:01 +0100 Subject: [PATCH 002/218] cosmic: add binary cache server --- nix-os/desktopManagers/cosmic.nix | 4 ++++ nix-os/displayManagers/cosmic-greeter.nix | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/nix-os/desktopManagers/cosmic.nix b/nix-os/desktopManagers/cosmic.nix index 19232de..a26c073 100644 --- a/nix-os/desktopManagers/cosmic.nix +++ b/nix-os/desktopManagers/cosmic.nix @@ -18,6 +18,10 @@ in config = { services.xserver.desktopManager.cosmic.enable = true; nixpkgs.overlays = [ cosmicPkgsOverlay ]; + nix.settings = { + substituters = [ "https://cosmic.cachix.org/" ]; + trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ]; + }; }; options = { cosmic-applets = lib.mkOption {default = pkgs.cosmic-applets;}; diff --git a/nix-os/displayManagers/cosmic-greeter.nix b/nix-os/displayManagers/cosmic-greeter.nix index 7d5a074..b66341a 100644 --- a/nix-os/displayManagers/cosmic-greeter.nix +++ b/nix-os/displayManagers/cosmic-greeter.nix @@ -19,6 +19,10 @@ in services.xserver.desktopManager.cosmic.enable = true; services.xserver.displayManager.cosmic-greeter.enable = true; nixpkgs.overlays = [ cosmicPkgsOverlay ]; + nix.settings = { + substituters = [ "https://cosmic.cachix.org/" ]; + trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ]; + }; }; options = { cosmic-greeter = lib.mkOption {default = pkgs.cosmic-greeter;}; From 9fffce71cdb79690e2efac03ed6a38b74f1a7724 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 19 Apr 2024 22:51:28 +0200 Subject: [PATCH 003/218] Cosmic+Cosmic greeter: Align to upstream changes --- nix-os/desktopManagers/cosmic.nix | 26 +---------------------- nix-os/displayManagers/cosmic-greeter.nix | 6 +----- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/nix-os/desktopManagers/cosmic.nix b/nix-os/desktopManagers/cosmic.nix index a26c073..589ee56 100644 --- a/nix-os/desktopManagers/cosmic.nix +++ b/nix-os/desktopManagers/cosmic.nix @@ -16,35 +16,11 @@ in "${nixos-cosmic}/nixos/cosmic/module.nix" ]; config = { - services.xserver.desktopManager.cosmic.enable = true; + services.desktopManager.cosmic.enable = true; nixpkgs.overlays = [ cosmicPkgsOverlay ]; nix.settings = { substituters = [ "https://cosmic.cachix.org/" ]; trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ]; }; }; - options = { - cosmic-applets = lib.mkOption {default = pkgs.cosmic-applets;}; - cosmic-applibrary = lib.mkOption {default = pkgs.cosmic-applibrary;}; - cosmic-bg = lib.mkOption {default = pkgs.cosmic-bg;}; - cosmic-comp = lib.mkOption {default = pkgs.cosmic-comp;}; - cosmic-design-demo = lib.mkOption {default = pkgs.cosmic-design;}; - cosmic-edit = lib.mkOption {default = pkgs.cosmic-edit;}; - cosmic-files = lib.mkOption {default = pkgs.cosmic-files;}; - cosmic-icons = lib.mkOption {default = pkgs.cosmic-icons;}; - cosmic-launcher = lib.mkOption {default = pkgs.cosmic-launcher;}; - cosmic-notifications = lib.mkOption {default = pkgs.cosmic-notifications;}; - cosmic-osd = lib.mkOption {default = pkgs.cosmic-osd;}; - cosmic-panel = lib.mkOption {default = pkgs.cosmic-panel;}; - cosmic-protocols = lib.mkOption {default = pkgs.cosmic-protocols;}; - cosmic-randr = lib.mkOption {default = pkgs.cosmic-randr;}; - cosmic-screenshot = lib.mkOption {default = pkgs.cosmic-screenshot;}; - cosmic-session = lib.mkOption {default = pkgs.cosmic-session;}; - cosmic-settings = lib.mkOption {default = pkgs.cosmic-settings;}; - cosmic-settings-daemon = lib.mkOption {default = pkgs.cosmic-settings;}; - cosmic-term = lib.mkOption {default = pkgs.cosmic-term;}; - cosmic-workspaces-epoch = lib.mkOption {default = pkgs.cosmic-workspaces;}; - wrapCosmicAppsHook = lib.mkOption {default = pkgs.wrapCosmicAppsHook;}; - xdg-desktop-portal-cosmic = lib.mkOption {default = pkgs.xdg-desktop-portal-cosmic;}; - }; } diff --git a/nix-os/displayManagers/cosmic-greeter.nix b/nix-os/displayManagers/cosmic-greeter.nix index b66341a..da54a6d 100644 --- a/nix-os/displayManagers/cosmic-greeter.nix +++ b/nix-os/displayManagers/cosmic-greeter.nix @@ -16,15 +16,11 @@ in "${nixos-cosmic}/nixos/cosmic-greeter/module.nix" ]; config = { - services.xserver.desktopManager.cosmic.enable = true; - services.xserver.displayManager.cosmic-greeter.enable = true; + services.displayManager.cosmic-greeter.enable = true; nixpkgs.overlays = [ cosmicPkgsOverlay ]; nix.settings = { substituters = [ "https://cosmic.cachix.org/" ]; trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ]; }; }; - options = { - cosmic-greeter = lib.mkOption {default = pkgs.cosmic-greeter;}; - }; } From a26bb74da1d5eb681c8f3f25fd0fa1c1a321d452 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 3 Jul 2024 23:51:47 +0200 Subject: [PATCH 004/218] pkgs/overlays/unstable: pass crossSystem only when needed that is, only when buildPlatform and hostPlatform are not identical, fixes difference and build failure of stdenv, when using through overlay certain odd packages like `androidStudioPackages.canary` --- pkgs/overlays/unstable.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/overlays/unstable.nix b/pkgs/overlays/unstable.nix index 2a20c30..1cf4bae 100644 --- a/pkgs/overlays/unstable.nix +++ b/pkgs/overlays/unstable.nix @@ -28,7 +28,7 @@ let # localSystem -> pkgs.stdenv.buildPlatform localSystem = nixpkgs.stdenv.buildPlatform; # crossSystem -> pkgs.stdenv.hostPlatform or pkgs.stdenv.targetPlatform ?? - crossSystem = nixpkgs.stdenv.hostPlatform; + # passing below # config -> pkgs.config config = nixpkgs.config; # overlays -> partial of pkgs.overlays @@ -36,7 +36,11 @@ let # crossOverlays -> partial of pkgs.overlays # crossOverlays are merged to overlays, not sure what issues that might raise. # ignoring. - }; + } // (if nixpkgs.stdenv.buildPlatform == nixpkgs.stdenv.hostPlatform then {} else { + # workaround for some odd structured packages that changes behaviour + # when crossSystem is passed. + crossSystem = nixpkgs.stdenv.hostPlatform; + }); in { unstable = if useUnstable then unstablePkgsForNixpkgs self else self; From 311e7281e1b9b32bf0cd5437f98a54441a87e6ab Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 6 Jul 2024 02:38:47 +0200 Subject: [PATCH 005/218] nixos/core-destkop: add fonts --- nix-os/core-desktop.nix | 7 +++++++ nix-os/shell.nix | 1 + 2 files changed, 8 insertions(+) diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix index 07cd85d..81725dd 100644 --- a/nix-os/core-desktop.nix +++ b/nix-os/core-desktop.nix @@ -24,5 +24,12 @@ services.openssh.extraConfig = '' X11Forwarding yes ''; + + # Fonts + fonts.packages = with pkgs; [ + corefonts + nerdfonts + roboto + ]; }; } diff --git a/nix-os/shell.nix b/nix-os/shell.nix index 235177c..bdbd0c8 100644 --- a/nix-os/shell.nix +++ b/nix-os/shell.nix @@ -47,6 +47,7 @@ in ''; environment.etc."xdg/kitty/kitty.conf".text = '' + font_family MesloLGS Nerd Font font_size 10.0 scrollback_lines 10000 window_border_width 0.5 From c5292e8a3118f63d262a6823276a2ff283583b05 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 6 Jul 2024 04:23:21 +0200 Subject: [PATCH 006/218] nixos/account: add ozone-platform argument in vivaldi --- nix-os/account.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nix-os/account.nix b/nix-os/account.nix index 22bdc01..9affded 100644 --- a/nix-os/account.nix +++ b/nix-os/account.nix @@ -17,7 +17,10 @@ initialPassword = "nixos"; packages = with pkgs; [ firefox - (vivaldi.override { proprietaryCodecs = true; }) + (vivaldi.override { + proprietaryCodecs = true; + commandLineArgs = [ "--ozone-platform=wayland" ]; + }) discord-canary unstablePkgs.vscode gimp From ccae4f8ef4f4967272ee51becfce866f18963c3b Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 7 Jul 2024 08:16:17 +0200 Subject: [PATCH 007/218] outputs: inherit self --- outputs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.nix b/outputs.nix index ad24442..c466f63 100644 --- a/outputs.nix +++ b/outputs.nix @@ -5,7 +5,7 @@ let lib = (import "${inputs.nixpkgs}/lib").extend (import ./lib/overlays/version-info-fixup.nix { inherit inputs; }); self = { - inherit lib inputs; + inherit inputs lib self; modifiedNixpkgs = import ./pkgs/top-level/impure.nix; modifiedNixpkgsPure = import ./pkgs/top-level/default.nix; overlays = { From d5b5519f4f4a432482b387be21ef0b3dd149fb2c Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 7 Jul 2024 08:34:47 +0200 Subject: [PATCH 008/218] outputs: allow string interpolation --- default.nix | 4 ++-- outputs.nix | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/default.nix b/default.nix index 3ce80ff..0c9248a 100644 --- a/default.nix +++ b/default.nix @@ -47,5 +47,5 @@ let type != "unknown" && builtins.baseNameOf path != ".git" && !matchesGitIgnore path ) ./.; in -if !(evaluatingInStore) then import selfInStore -else import ./outputs.nix +if !(evaluatingInStore) then { ... }@args: import selfInStore ({ selfPath = selfInStore; } // args ) +else { ... }@args: import ./outputs.nix ({ selfPath = selfInStore; } // args) diff --git a/outputs.nix b/outputs.nix index c466f63..6793c9d 100644 --- a/outputs.nix +++ b/outputs.nix @@ -1,4 +1,7 @@ -{ inputs ? import ./inputs.nix {} }: +{ + inputs ? import ./inputs.nix {}, + selfPath ? ./. +}: let @@ -6,6 +9,7 @@ lib = (import "${inputs.nixpkgs}/lib").extend (import ./lib/overlays/version-inf self = { inherit inputs lib self; + __toString = _: selfPath; modifiedNixpkgs = import ./pkgs/top-level/impure.nix; modifiedNixpkgsPure = import ./pkgs/top-level/default.nix; overlays = { @@ -40,8 +44,8 @@ self = { ./hosts/${name} { config.nixpkgs.overlays = [ - ( import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = "${builtins.toString ./.}/pkgs/top-level/impure.nix"; } ) - ( import "${inputs.nixpkgs}/pkgs/top-level/by-name-overlay.nix" "${builtins.toString ./.}/pkgs/by-name" ) + ( import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = "${self}/pkgs/top-level/impure.nix"; } ) + ( import "${inputs.nixpkgs}/pkgs/top-level/by-name-overlay.nix" "${self}/pkgs/by-name" ) self.overlays.versionInfoFixup ]; } From 1bd184f69fd93f84370097d469bce45c83727341 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 7 Jul 2024 08:53:55 +0200 Subject: [PATCH 009/218] lock: update --- lock.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lock.nix b/lock.nix index 09cca69..029e836 100644 --- a/lock.nix +++ b/lock.nix @@ -4,7 +4,7 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "10c832d0548e9e3a6df7eb51e68c2783212a303e"; - sha256 = "1p206hgfxbz0rmkzaslfrknbdss4n4dnb09pi5466h8ksmm8216q"; + revision = "c0d0be00d4ecc4b51d2d6948e37466194c1e6c51"; + sha256 = "1yrqrpmrdzbzcwb7kv9m6gbzjk68ljs098fv246brq6mc3s4v5qk"; }; } From 10b718fff30a0b5d59a6c260d55460f328fe1501 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 7 Jul 2024 09:08:49 +0200 Subject: [PATCH 010/218] pkgs/overlays/selfExpr: add missing parentheses in generated nix code --- pkgs/overlays/selfExpr.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/overlays/selfExpr.nix b/pkgs/overlays/selfExpr.nix index ae28729..4dd0312 100644 --- a/pkgs/overlays/selfExpr.nix +++ b/pkgs/overlays/selfExpr.nix @@ -25,11 +25,13 @@ self: super: { in '' { ... } @ args: - import ${nixpkgsPath} { - ${self.lib.optionalString useConfig configText} - } // builtins.removeAttrs args (builtins.fromJSON ''' - ${removedAttrNamesText} - ''') + import ${nixpkgsPath} ( + { + ${self.lib.optionalString useConfig configText} + } // builtins.removeAttrs args (builtins.fromJSON ''' + ${removedAttrNamesText} + ''') + ) ''; mkNixpkgsChannel = args: self.writeTextFile { From 89b96240319660f9b79f14bcb82e921749f58543 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 7 Jul 2024 09:30:08 +0200 Subject: [PATCH 011/218] pkgs/top-level: fix selfExpr nixpkgsPath argument --- pkgs/top-level/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index 5bfdc46..85abb2e 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -12,7 +12,8 @@ let options = (builtins.removeAttrs args attrsToRemove) // { overlays = (args.overlays or []) ++ [ - ( import ../overlays/selfExpr.nix { nixpkgsPath = ./impure.nix; } ) + # ../.. should be nix store path that represents self in outputs.nix that is gc-rooted by this point + ( import ../overlays/selfExpr.nix { nixpkgsPath = "${builtins.toString ../..}/pkgs/top-level/impure.nix"; } ) ( import ../overlays/unstable.nix ) ( import ../overlays/version-info-fixup.nix { inherit inputs; } ) ( import "${inputs.nixpkgs}/pkgs/top-level/by-name-overlay.nix" ../by-name ) From e95279f45ce4f150d6dcc60edcbc535476b863de Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 9 Jul 2024 06:34:10 +0200 Subject: [PATCH 012/218] pkgs/top-level: allow overrides through by-name and check for file existence before using path --- outputs.nix | 2 +- pkgs/top-level/by-name-overlay.nix | 50 ++++++++++++++++++++++++++++++ pkgs/top-level/default.nix | 2 +- 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 pkgs/top-level/by-name-overlay.nix diff --git a/outputs.nix b/outputs.nix index 6793c9d..aced032 100644 --- a/outputs.nix +++ b/outputs.nix @@ -45,7 +45,7 @@ self = { { config.nixpkgs.overlays = [ ( import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = "${self}/pkgs/top-level/impure.nix"; } ) - ( import "${inputs.nixpkgs}/pkgs/top-level/by-name-overlay.nix" "${self}/pkgs/by-name" ) + ( import ./pkgs/top-level/by-name-overlay.nix "${self}/pkgs/by-name" ) self.overlays.versionInfoFixup ]; } diff --git a/pkgs/top-level/by-name-overlay.nix b/pkgs/top-level/by-name-overlay.nix new file mode 100644 index 0000000..ed63216 --- /dev/null +++ b/pkgs/top-level/by-name-overlay.nix @@ -0,0 +1,50 @@ +# Modified copy of github:NixOS/nixpkgs pkgs/top-level/by-name-overlay.nix +# as of commit c0d0be00d4ecc4b51d2d6948e37466194c1e6c51 + +# This file turns the pkgs/by-name directory into an overlay that adds all the defined packages. +# No validity checks are done here. + +# Type: Path -> Overlay +baseDirectory: +let + lib = (import ../../outputs.nix {}).lib; + + inherit (builtins) + readDir + ; + + inherit (lib.attrsets) + mapAttrs + mapAttrsToList + mergeAttrsList + ; + + # Package files for a single shard + # Type: String -> String -> String -> AttrsOf Path + namesForShard = nixFilename: shard: type: + if type != "directory" then + # Ignore all non-directories. + { } + else + mapAttrs + (name: _: baseDirectory + "/${shard}/${name}/${nixFilename}") + (readDir (baseDirectory + "/${shard}")); + + # The attribute set mapping names to the package files defining them + # Type: String -> AttrsOf Path + packageFiles = nixFilename: lib.pipe baseDirectory [ + readDir + (mapAttrsToList (namesForShard nixFilename)) + mergeAttrsList + # Filter out paths that don't have a ${nixFilename} file + (lib.filterAttrs (_: lib.pathExists)) + ]; +in +self: super: +mapAttrs (name: file: + self.callPackage file { inherit self super; package = super.${name}; } +) (packageFiles "override.nix") +// mapAttrs (name: file: + self.callPackage file { } +) (packageFiles "package.nix") + diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index 85abb2e..fd3e12a 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -16,7 +16,7 @@ let ( import ../overlays/selfExpr.nix { nixpkgsPath = "${builtins.toString ../..}/pkgs/top-level/impure.nix"; } ) ( import ../overlays/unstable.nix ) ( import ../overlays/version-info-fixup.nix { inherit inputs; } ) - ( import "${inputs.nixpkgs}/pkgs/top-level/by-name-overlay.nix" ../by-name ) + ( import ./by-name-overlay.nix ../by-name ) ]; }; in From 28bf1a9a0d59f8d350aea5df609565acc05f2725 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 9 Jul 2024 06:34:48 +0200 Subject: [PATCH 013/218] pkgs/nix-index: use cnf output similar to default NixOS one --- pkgs/by-name/ni/nix-index/cnfOutput.patch | 66 +++++++++++++++++++++++ pkgs/by-name/ni/nix-index/override.nix | 9 ++++ 2 files changed, 75 insertions(+) create mode 100644 pkgs/by-name/ni/nix-index/cnfOutput.patch create mode 100644 pkgs/by-name/ni/nix-index/override.nix diff --git a/pkgs/by-name/ni/nix-index/cnfOutput.patch b/pkgs/by-name/ni/nix-index/cnfOutput.patch new file mode 100644 index 0000000..8564d9b --- /dev/null +++ b/pkgs/by-name/ni/nix-index/cnfOutput.patch @@ -0,0 +1,66 @@ +diff --git a/command-not-found.sh b/command-not-found.sh +index 5f30bad..3854297 100755 +--- a/command-not-found.sh ++++ b/command-not-found.sh +@@ -73,51 +73,30 @@ EOF + else + if [ -e "$HOME/.nix-profile/manifest.json" ]; then + >&2 cat <&2 cat <&2 cat <&2 echo " nix profile install $toplevel#$attr" +- else +- >&2 echo " nix-env -iA $toplevel.$attr" +- fi +- done <<< "$attrs" +- +- >&2 cat <&2 echo " nix shell $toplevel#$attr -c $cmd ..." ++ >&2 echo " nix shell $toplevel#$attr" + else +- >&2 echo " nix-shell -p $attr --run '$cmd ...'" ++ >&2 echo " nix-shell -p $attr" + fi + done <<< "$attrs" + ;; diff --git a/pkgs/by-name/ni/nix-index/override.nix b/pkgs/by-name/ni/nix-index/override.nix new file mode 100644 index 0000000..e0513e4 --- /dev/null +++ b/pkgs/by-name/ni/nix-index/override.nix @@ -0,0 +1,9 @@ +{self, super, package }: + +package.override { + nix-index-unwrapped = self.nix-index-unwrapped.overrideAttrs (oldAttrs: { + patches = oldAttrs.patches or [] ++ [ + ./cnfOutput.patch + ]; + }); +} From 069c5e979a2a06686def6f9ce5e2ede4d51ad3fe Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 9 Jul 2024 06:35:14 +0200 Subject: [PATCH 014/218] nixos/core: use nix-index --- nix-os/core.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nix-os/core.nix b/nix-os/core.nix index cfb55e4..bb6ca15 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -79,6 +79,13 @@ in rerere.enabled = true; }; + # Use nix-index for command-not-found handler + programs.command-not-found.enable = false; + programs.nix-index = { + enable = true; + enableBashIntegration = true; + }; + # Enable fail2ban because of the OpenSSH server services.fail2ban = { enable = true; From 6e76c7422a05af981aa03e0b9ae4bab929838bd5 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 9 Jul 2024 11:22:27 +0200 Subject: [PATCH 015/218] nixos/core: use inline nix-index override It was used only in this place --- nix-os/core.nix | 8 ++++++++ pkgs/by-name/ni/nix-index/override.nix | 9 --------- 2 files changed, 8 insertions(+), 9 deletions(-) delete mode 100644 pkgs/by-name/ni/nix-index/override.nix diff --git a/nix-os/core.nix b/nix-os/core.nix index bb6ca15..30d4c7e 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -82,6 +82,14 @@ in # Use nix-index for command-not-found handler programs.command-not-found.enable = false; programs.nix-index = { + package = pkgs.nix-index.override { + nix-index-unwrapped = pkgs.nix-index-unwrapped.overrideAttrs (oldAttrs: { + patches = oldAttrs.patches or [] ++ [ + ../pkgs/by-name/ni/nix-index/cnfOutput.patch + ]; + }); + + }; enable = true; enableBashIntegration = true; }; diff --git a/pkgs/by-name/ni/nix-index/override.nix b/pkgs/by-name/ni/nix-index/override.nix deleted file mode 100644 index e0513e4..0000000 --- a/pkgs/by-name/ni/nix-index/override.nix +++ /dev/null @@ -1,9 +0,0 @@ -{self, super, package }: - -package.override { - nix-index-unwrapped = self.nix-index-unwrapped.overrideAttrs (oldAttrs: { - patches = oldAttrs.patches or [] ++ [ - ./cnfOutput.patch - ]; - }); -} From 8c1eb9dec32fc58c0b43a47784bd0c4703337986 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 9 Jul 2024 11:47:10 +0200 Subject: [PATCH 016/218] pkgs/mkWrappedExecutable: factor out to its own package --- nix-os/core.nix | 18 +-------------- .../mk/mkWrappedExecutable/package.nix | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 pkgs/by-name/mk/mkWrappedExecutable/package.nix diff --git a/nix-os/core.nix b/nix-os/core.nix index 30d4c7e..53eaab8 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -5,23 +5,7 @@ { inputs, lib, pkgs, ... }: let - /* - * pkg: package - nixpkgs package - * exe: string - executable (under bin) in pkgs - * wrapperArgs: string[] - arguments to pass to the wrapper - */ - mkWrappedExecutable = {pkg, exe ? pkg.meta.mainProgram, wrapperArgs}: let inherit (pkgs) lib makeWrapper; in lib.hiPrio ( - pkgs.stdenv.mkDerivation { - inherit wrapperArgs; - name = "${pkg.name}-wrap-${exe}"; - nativeBuildInputs = [ makeWrapper ]; - phases = ["installPhase"]; - installPhase = '' - mkdir -p $out/bin - makeWrapper ${pkg}/bin/${exe} $out/bin/${exe} $wrapperArgs - ''; - } - ); + inherit (pkgs) mkWrappedExecutable; # bool -> nixpkgs[] wrappedNixExecutables = inEnvironment: assert builtins.isBool inEnvironment; [ diff --git a/pkgs/by-name/mk/mkWrappedExecutable/package.nix b/pkgs/by-name/mk/mkWrappedExecutable/package.nix new file mode 100644 index 0000000..039b6f4 --- /dev/null +++ b/pkgs/by-name/mk/mkWrappedExecutable/package.nix @@ -0,0 +1,22 @@ +{ + lib, + makeWrapper, + stdenv +}: + +/* + pkg: package - nixpkgs package + exe: string - executable (under bin) in pkg + wrapperArgs: string[] - arguments to pass to the wrapper +*/ +{ pkg, exe ? pkg.meta.mainProgram, wrapperArgs }: +lib.hiPrio (stdenv.mkDerivation { + inherit wrapperArgs; + name = "${pkg.name}-wrap-${exe}"; + nativeBuildInputs = [ makeWrapper ]; + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out/bin + makeWrapper ${pkg}/bin/${exe} $out/bin/${exe} $wrapperArgs + ''; +}) From 095b610e613535cb127f78a56f173ad57af16290 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 12 Jul 2024 09:01:47 +0200 Subject: [PATCH 017/218] nixos/account: switch discord-canary to vesktop --- nix-os/account.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix-os/account.nix b/nix-os/account.nix index 9affded..b1693ad 100644 --- a/nix-os/account.nix +++ b/nix-os/account.nix @@ -21,7 +21,7 @@ proprietaryCodecs = true; commandLineArgs = [ "--ozone-platform=wayland" ]; }) - discord-canary + vesktop unstablePkgs.vscode gimp inkscape From af82adb455158a4a1a13c9e48a0d75275ca3e10a Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 21 Jul 2024 21:37:06 +0200 Subject: [PATCH 018/218] lock: update nixpkgs --- lock.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lock.nix b/lock.nix index 029e836..930ea4e 100644 --- a/lock.nix +++ b/lock.nix @@ -4,7 +4,7 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "c0d0be00d4ecc4b51d2d6948e37466194c1e6c51"; - sha256 = "1yrqrpmrdzbzcwb7kv9m6gbzjk68ljs098fv246brq6mc3s4v5qk"; + revision = "0c53b6b8c2a3e46c68e04417e247bba660689c9d"; + sha256 = "02ag4j9v48h861bakxf7nvcz85wl6dv8wvfj0v1r7v7j8jpwp8vg"; }; } From 460b58d6ddd6267a4c982ad217ca17bcf0c1759c Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 21 Jul 2024 22:01:04 +0200 Subject: [PATCH 019/218] nixos/nvidia: update to 555.58.02 --- nix-os/nvidia.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nix-os/nvidia.nix b/nix-os/nvidia.nix index 2113d0a..c166ac5 100644 --- a/nix-os/nvidia.nix +++ b/nix-os/nvidia.nix @@ -13,10 +13,12 @@ open = false; nvidiaSettings = true; package = config.boot.kernelPackages.nvidiaPackages.mkDriver { - version = "555.42.02"; - sha256_64bit = "sha256-k7cI3ZDlKp4mT46jMkLaIrc2YUx1lh1wj/J4SVSHWyk="; - settingsSha256 = "sha256-rtDxQjClJ+gyrCLvdZlT56YyHQ4sbaL+d5tL4L4VfkA="; - persistencedSha256 = ""; + version = "555.58.02"; + sha256_64bit = "sha256-xctt4TPRlOJ6r5S54h5W6PT6/3Zy2R4ASNFPu8TSHKM="; + sha256_aarch64 = "sha256-wb20isMrRg8PeQBU96lWJzBMkjfySAUaqt4EgZnhyF8="; + openSha256 = "sha256-8hyRiGB+m2hL3c9MDA/Pon+Xl6E788MZ50WrrAGUVuY="; + settingsSha256 = "sha256-ZpuVZybW6CFN/gz9rx+UJvQ715FZnAOYfHn5jt5Z2C8="; + persistencedSha256 = "sha256-a1D7ZZmcKFWfPjjH1REqPM5j/YLWKnbkP9qfRyIyxAw="; }; }; nixpkgs.config.nvidia.acceptLicense = true; From f89c97d3a1f38f0c2b4c6c4fde5d5eedd194300a Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 28 Jul 2024 23:11:38 +0200 Subject: [PATCH 020/218] pkgs/mkScriptOverride: init --- pkgs/by-name/mk/mkScriptOverride/package.nix | 29 ++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 pkgs/by-name/mk/mkScriptOverride/package.nix diff --git a/pkgs/by-name/mk/mkScriptOverride/package.nix b/pkgs/by-name/mk/mkScriptOverride/package.nix new file mode 100644 index 0000000..6777a0c --- /dev/null +++ b/pkgs/by-name/mk/mkScriptOverride/package.nix @@ -0,0 +1,29 @@ +{ + lib, + stdenv, +}: + +{ + src, + script, + ... +} @ args: +lib.hiPrio (stdenv.mkDerivation ( + { + src = src; + name = "${src.name}-script-override"; + phases = [ "installPhase" "scriptOverridePhase" ]; + installPhase = '' + runHook preInstall + + cp -r $src $out + chmod u+w -R $out + + runHook postInstall + ''; + scriptOverridePhase = script; + } // lib.removeAttrs args [ + "pkg" + "commands" + ] +)) From 78ab704ca3f7caefefb590eb76ecb9dc029fd51b Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 28 Jul 2024 23:22:53 +0200 Subject: [PATCH 021/218] nixos/gnupg: create --- hosts/main.nix | 1 + hosts/tablet.nix | 1 + nix-os/gnupg.nix | 15 +++++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 nix-os/gnupg.nix diff --git a/hosts/main.nix b/hosts/main.nix index 0fca5f6..cfa6e41 100644 --- a/hosts/main.nix +++ b/hosts/main.nix @@ -19,6 +19,7 @@ ../nix-os/xdg-default-apps.nix ../nix-os/services/nix-binary-cache.nix ../nix-os/udev.nix + ../nix-os/gnupg.nix "${inputs.nixos-vscode-server}" ]; diff --git a/hosts/tablet.nix b/hosts/tablet.nix index 7c449bf..ad06d9b 100644 --- a/hosts/tablet.nix +++ b/hosts/tablet.nix @@ -8,6 +8,7 @@ ../nix-os/adb.nix ../nix-os/locale.nix ../nix-os/shell.nix + ../nix-os/gnupg.nix ../nix-os/desktopManagers/gnome.nix ../nix-os/displayManagers/gdm.nix diff --git a/nix-os/gnupg.nix b/nix-os/gnupg.nix new file mode 100644 index 0000000..1c9b20e --- /dev/null +++ b/nix-os/gnupg.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: + +{ + config = { + # Use pcscd for smartcard support + services.pcscd.enable = true; + + environment.systemPackages = [( + pkgs.gnupg.overrideAttrs (superAttrs: { + configureFlags = superAttrs.configureFlags or [] + ++ [ "--disable-ccid-driver" ]; + }) + )]; + }; +} From f4772d075a92bdddd2f3f2d8e1148d891771f210 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 3 Aug 2024 22:15:32 +0200 Subject: [PATCH 022/218] output: allow to have host defined in subdirectory --- outputs.nix | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/outputs.nix b/outputs.nix index aced032..f69f3bf 100644 --- a/outputs.nix +++ b/outputs.nix @@ -22,22 +22,22 @@ self = { filePaths = lib.pipe ./hosts [ builtins.readDir ( lib.filterAttrs (name: type: - # filter out non-nix files - type == "regular" - # filter out files that don't end in .nix - && lib.hasSuffix ".nix" name + ( # regular .nix files + (type == "regular" && lib.hasSuffix ".nix" name) + || # directories that contain a default.nix file + (type == "directory" && builtins.pathExists "${./hosts}/${name}/default.nix") + ) # filter out files that start with . && !lib.hasPrefix "." name )) - (lib.mapAttrsToList (name: _: name)) ]; nixosSystem = import "${inputs.nixpkgs}/nixos/lib/eval-config.nix"; in # mapped list of nix file paths to attrSet with initialized NixOS configurations, # whose names are derived from file names lib.pipe filePaths [ - (builtins.map (name: { - name = builtins.substring 0 (builtins.stringLength name - 4) name; + (builtins.mapAttrs (name: type: { + name = if type == "directory" then name else builtins.substring 0 (builtins.stringLength name - 4) name; value = nixosSystem { inherit lib; modules = [ @@ -53,6 +53,7 @@ self = { specialArgs = { inherit self inputs; }; }; })) + builtins.attrValues builtins.listToAttrs ]; }; From 79527c7663301d9d7e91ca14d14fb11d11639233 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 3 Aug 2024 22:17:25 +0200 Subject: [PATCH 023/218] hosts/main: move to subdirectory --- hosts/{main.nix => main/default.nix} | 35 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 18 deletions(-) rename hosts/{main.nix => main/default.nix} (55%) diff --git a/hosts/main.nix b/hosts/main/default.nix similarity index 55% rename from hosts/main.nix rename to hosts/main/default.nix index cfa6e41..8faf041 100644 --- a/hosts/main.nix +++ b/hosts/main/default.nix @@ -2,24 +2,23 @@ { imports = [ - ../nix-os/core.nix - ../nix-os/core-desktop.nix - ../nix-os/nvidia.nix - ../nix-os/docker.nix - ../nix-os/razer.nix - ../nix-os/desktopManagers/gnome.nix - ../nix-os/displayManagers/gdm.nix - #../nix-os/desktop/kde-plasma.nix - ../nix-os/shell.nix - ../nix-os/virtualization.nix - ../nix-os/polkit/disable-shutdown.nix - ../nix-os/locale.nix - ../nix-os/adb.nix - ../nix-os/account.nix - ../nix-os/xdg-default-apps.nix - ../nix-os/services/nix-binary-cache.nix - ../nix-os/udev.nix - ../nix-os/gnupg.nix + ../../nix-os/core.nix + ../../nix-os/core-desktop.nix + ../../nix-os/nvidia.nix + ../../nix-os/docker.nix + ../../nix-os/razer.nix + ../../nix-os/desktopManagers/gnome.nix + ../../nix-os/displayManagers/gdm.nix + ../../nix-os/shell.nix + ../../nix-os/virtualization.nix + ../../nix-os/polkit/disable-shutdown.nix + ../../nix-os/locale.nix + ../../nix-os/adb.nix + ../../nix-os/account.nix + ../../nix-os/xdg-default-apps.nix + ../../nix-os/services/nix-binary-cache.nix + ../../nix-os/udev.nix + ../../nix-os/gnupg.nix "${inputs.nixos-vscode-server}" ]; From 7ce2abb122aec3a13ab31e1d31efeb9072654bad Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 3 Aug 2024 23:29:29 +0200 Subject: [PATCH 024/218] hosts/main: move wireplumber configuration to git --- hosts/main/default.nix | 12 ++++++++++ hosts/main/wireplumber/51-digital-output.conf | 10 +++++++++ hosts/main/wireplumber/51-hdmi-otuput.conf | 10 +++++++++ .../51-razerHeadphones-device.conf | 11 ++++++++++ .../wireplumber/51-razerHeadphones-input.conf | 10 +++++++++ .../51-razerHeadphones-output.conf | 22 +++++++++++++++++++ 6 files changed, 75 insertions(+) create mode 100644 hosts/main/wireplumber/51-digital-output.conf create mode 100644 hosts/main/wireplumber/51-hdmi-otuput.conf create mode 100644 hosts/main/wireplumber/51-razerHeadphones-device.conf create mode 100644 hosts/main/wireplumber/51-razerHeadphones-input.conf create mode 100644 hosts/main/wireplumber/51-razerHeadphones-output.conf diff --git a/hosts/main/default.nix b/hosts/main/default.nix index 8faf041..d35b5bc 100644 --- a/hosts/main/default.nix +++ b/hosts/main/default.nix @@ -45,6 +45,18 @@ ]; }; + services.pipewire.wireplumber.configPackages = [( + pkgs.stdenvNoCC.mkDerivation { + name = "wireplumber-config"; + src = ./wireplumber; + phases = [ "installPhase" ]; + installPhase = '' + mkdir -p $out/share/wireplumber/wireplumber.conf.d + cp -r $src/* $out/share/wireplumber/wireplumber.conf.d + ''; + } + )]; + services.printing.startWhenNeeded = false; system.stateVersion = "23.05"; diff --git a/hosts/main/wireplumber/51-digital-output.conf b/hosts/main/wireplumber/51-digital-output.conf new file mode 100644 index 0000000..57bdff3 --- /dev/null +++ b/hosts/main/wireplumber/51-digital-output.conf @@ -0,0 +1,10 @@ +monitor.alsa.rules = [{ + matches = [{ + node.name = "alsa_output.pci-0000_00_1f.3.iec958-stereo" + }] + actions = { + update-props = { + node.description = "Digital Output" + } + } +}] diff --git a/hosts/main/wireplumber/51-hdmi-otuput.conf b/hosts/main/wireplumber/51-hdmi-otuput.conf new file mode 100644 index 0000000..265b78a --- /dev/null +++ b/hosts/main/wireplumber/51-hdmi-otuput.conf @@ -0,0 +1,10 @@ +monitor.alsa.rules = [{ + matches = [{ + node.name = "alsa_output.pci-0000_01_00.1.hdmi-stereo" + }] + actions = { + update-props = { + node.description = "Monitor speakers" + } + } +}] diff --git a/hosts/main/wireplumber/51-razerHeadphones-device.conf b/hosts/main/wireplumber/51-razerHeadphones-device.conf new file mode 100644 index 0000000..b159a49 --- /dev/null +++ b/hosts/main/wireplumber/51-razerHeadphones-device.conf @@ -0,0 +1,11 @@ +monitor.alsa.rules = [{ + matches = [{ + device.name = "alsa_card.usb-Razer_Razer_USB_Audio_Controller_000000000000000000000000-00" + }] + actions = { + update-props = { + device.description = "Headphones" + device.profile = "Pro Audio" + } + } +}] diff --git a/hosts/main/wireplumber/51-razerHeadphones-input.conf b/hosts/main/wireplumber/51-razerHeadphones-input.conf new file mode 100644 index 0000000..c24a599 --- /dev/null +++ b/hosts/main/wireplumber/51-razerHeadphones-input.conf @@ -0,0 +1,10 @@ +monitor.alsa.rules = [{ + matches = [{ + node.name = "alsa_input.usb-Razer_Razer_USB_Audio_Controller_000000000000000000000000-00.pro-input-0" + }] + actions = { + update-props = { + node.description = "Headphones" + } + } +}] diff --git a/hosts/main/wireplumber/51-razerHeadphones-output.conf b/hosts/main/wireplumber/51-razerHeadphones-output.conf new file mode 100644 index 0000000..11cb43e --- /dev/null +++ b/hosts/main/wireplumber/51-razerHeadphones-output.conf @@ -0,0 +1,22 @@ +monitor.alsa.rules = [ + { + matches = [{ + node.name = "alsa_output.usb-Razer_Razer_USB_Audio_Controller_000000000000000000000000-00.pro-output-0" + }] + actions = { + update-props = { + node.description = "Headphones (Chat)" + } + } + } + { + matches = [{ + node.name = "alsa_output.usb-Razer_Razer_USB_Audio_Controller_000000000000000000000000-00.pro-output-1" + }] + actions = { + update-props = { + node.description = "Headphones (Game)" + } + } + } +] From c52624db8f026314f4479f50590a5153d5c616c7 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 3 Aug 2024 23:31:34 +0200 Subject: [PATCH 025/218] lock: update nixpkgs --- lock.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lock.nix b/lock.nix index 930ea4e..2963614 100644 --- a/lock.nix +++ b/lock.nix @@ -4,7 +4,7 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "0c53b6b8c2a3e46c68e04417e247bba660689c9d"; - sha256 = "02ag4j9v48h861bakxf7nvcz85wl6dv8wvfj0v1r7v7j8jpwp8vg"; + revision = "05405724efa137a0b899cce5ab4dde463b4fd30b"; + sha256 = "06490pn22x9xl4chfx12iwdgx7nlbn14v8x05rnv2y1nancljisl"; }; } From ac2bd4cd0032676e5f2290520bb308b4cef5e507 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 8 Aug 2024 04:02:19 +0200 Subject: [PATCH 026/218] vm-cosmic: delete --- vm-cosmic.sh | 1 - 1 file changed, 1 deletion(-) delete mode 100755 vm-cosmic.sh diff --git a/vm-cosmic.sh b/vm-cosmic.sh deleted file mode 100755 index 1d5cd30..0000000 --- a/vm-cosmic.sh +++ /dev/null @@ -1 +0,0 @@ -nix-build '' -A vm -I nixos-config=./hosts/vm-cosmic.nix $@ && $(ls ./result/bin/run-*) -m 4096 && rm *.qcow2 From e5d2edff9a8c55cb79b4c131c8883a1e8cda38c7 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 8 Aug 2024 04:05:43 +0200 Subject: [PATCH 027/218] inputs: add cosmic-modules --- inputs.nix | 5 +++++ lock.nix | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/inputs.nix b/inputs.nix index 6c3a94d..334379b 100644 --- a/inputs.nix +++ b/inputs.nix @@ -15,5 +15,10 @@ let self = { url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs.revision}.tar.gz"; sha256 = "${lock.nixpkgs.sha256}"; }; + cosmic-modules = builtins.fetchTarball { + name = "cosmic-modules"; + url = "https://github.com/lilyinstarlight/nixos-cosmic/archive/${lock.cosmic-modules.revision}.tar.gz"; + sha256 = "${lock.cosmic-modules.sha256}"; + }; }; in self diff --git a/lock.nix b/lock.nix index 2963614..0b51177 100644 --- a/lock.nix +++ b/lock.nix @@ -7,4 +7,8 @@ revision = "05405724efa137a0b899cce5ab4dde463b4fd30b"; sha256 = "06490pn22x9xl4chfx12iwdgx7nlbn14v8x05rnv2y1nancljisl"; }; + cosmic-modules = { + revision = "d8b2b9aee034c10ca67848653171f576f87434a8"; + sha256 = "03i8smxgx2fdb9kkys81dihb5yja3nk9wjs1rx5h7f3b5kii1fd7"; + }; } From 56527b97cc834718fcb48a0da79e2a9ae6645bbe Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 8 Aug 2024 04:29:47 +0200 Subject: [PATCH 028/218] lock: update nixpkgs --- lock.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lock.nix b/lock.nix index 2963614..fc5e288 100644 --- a/lock.nix +++ b/lock.nix @@ -4,7 +4,7 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "05405724efa137a0b899cce5ab4dde463b4fd30b"; - sha256 = "06490pn22x9xl4chfx12iwdgx7nlbn14v8x05rnv2y1nancljisl"; + revision = "883180e6550c1723395a3a342f830bfc5c371f6b"; + sha256 = "01axrf25mahbxmp6vgfgx09dflbyaavr5liynkp6rpm4lkacr27f"; }; } From 6f5829e6abb8c3730c368d912652658fd72a953a Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 8 Aug 2024 04:34:03 +0200 Subject: [PATCH 029/218] hosts/vm: update configuration and create base vm --- hosts/{vm.nix => vm-base.nix} | 28 +++++++++++++++------------- hosts/vm-gnome.nix | 9 +++++++++ 2 files changed, 24 insertions(+), 13 deletions(-) rename hosts/{vm.nix => vm-base.nix} (51%) create mode 100644 hosts/vm-gnome.nix diff --git a/hosts/vm.nix b/hosts/vm-base.nix similarity index 51% rename from hosts/vm.nix rename to hosts/vm-base.nix index 0b99d01..1f3b796 100644 --- a/hosts/vm.nix +++ b/hosts/vm-base.nix @@ -1,19 +1,21 @@ -{ ... }: +{ lib, modulesPath, ... }: { imports = [ - ../nix-os/core.nix - ../nix-os/docker.nix - ../nix-os/desktopManagers/gnome.nix - ../nix-os/displayManagers/gdm.nix - #../nix-os/desktop/kde-plasma.nix - ../nix-os/shell.nix - ../nix-os/virtualization.nix - ../nix-os/polkit/disable-shutdown.nix - ../nix-os/locale.nix - ../nix-os/adb.nix + "${modulesPath}/virtualisation/qemu-vm.nix" ../nix-os/account.nix - ../nix-os/xdg-default-apps.nix + ../nix-os/core.nix + ../nix-os/locale.nix + ../nix-os/polkit/disable-shutdown.nix + ../nix-os/shell.nix ../nix-os/udev.nix + ../nix-os/xdg-default-apps.nix ]; -} \ No newline at end of file + + config = { + services.syncthing.enable = lib.mkForce false; + virtualisation = { + memorySize = 4096; + }; + }; +} diff --git a/hosts/vm-gnome.nix b/hosts/vm-gnome.nix new file mode 100644 index 0000000..2b54493 --- /dev/null +++ b/hosts/vm-gnome.nix @@ -0,0 +1,9 @@ +{ lib, ... }: + +{ + imports = [ + ./vm-base.nix + ../nix-os/desktopManagers/gnome.nix + ../nix-os/displayManagers/gdm.nix + ]; +} From 375a3f379ea90d770f643b7cd8b7e1705a0f14a7 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 8 Aug 2024 05:06:10 +0200 Subject: [PATCH 030/218] nixos: remove unnecessary if..then..else.. statements --- nix-os/account.nix | 5 ++--- nix-os/dconf-common.nix | 8 ++------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/nix-os/account.nix b/nix-os/account.nix index b1693ad..e7bb85c 100644 --- a/nix-os/account.nix +++ b/nix-os/account.nix @@ -1,4 +1,4 @@ -{ config, pkgs, unstablePkgs, ... }: +{ config, lib, pkgs, unstablePkgs, ... }: { imports = [ @@ -11,8 +11,7 @@ extraGroups = [ "users" "wheel" - (if config.programs.adb.enable then "adbusers" else null) - ]; + ] ++ lib.optional config.programs.adb.enable "adbusers"; linger = true; initialPassword = "nixos"; packages = with pkgs; [ diff --git a/nix-os/dconf-common.nix b/nix-os/dconf-common.nix index 2993f98..967d28f 100644 --- a/nix-os/dconf-common.nix +++ b/nix-os/dconf-common.nix @@ -65,15 +65,11 @@ "color-picker@tuberry" ]; favorite-apps = [ - (if builtins.elem pkgs.kitty config.environment.systemPackages then - "kitty.desktop" - else none) + "kitty.desktop" "vivaldi-stable.desktop" "code.desktop" "org.gnome.Nautilus.desktop" - (if config.programs.steam.enable then - "steam.desktop" - else none) + "steam.desktop" "pavucontrol.desktop" ]; }; From ec8be03e7fb060513afc5b83acc177cfdefc7a72 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 8 Aug 2024 04:38:11 +0200 Subject: [PATCH 031/218] hosts/vm-cosmic: use vm-base --- hosts/vm-cosmic.nix | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/hosts/vm-cosmic.nix b/hosts/vm-cosmic.nix index 5507267..00989ab 100644 --- a/hosts/vm-cosmic.nix +++ b/hosts/vm-cosmic.nix @@ -2,18 +2,8 @@ { imports = [ - ../nix-os/core.nix - ../nix-os/core-desktop.nix - ../nix-os/docker.nix + ./vm-base.nix ../nix-os/desktopManagers/cosmic.nix ../nix-os/displayManagers/cosmic-greeter.nix - #../nix-os/desktop/kde-plasma.nix - ../nix-os/shell.nix - ../nix-os/virtualization.nix - ../nix-os/polkit/disable-shutdown.nix - ../nix-os/locale.nix - ../nix-os/adb.nix - ../nix-os/account.nix - ../nix-os/xdg-default-apps.nix ]; } From dae61508df19bdba3a65658ea83c52eff3b4895e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 8 Aug 2024 06:06:41 +0200 Subject: [PATCH 032/218] pkgs/overlays/cosmic: create --- pkgs/overlays/cosmic-packages.nix | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 pkgs/overlays/cosmic-packages.nix diff --git a/pkgs/overlays/cosmic-packages.nix b/pkgs/overlays/cosmic-packages.nix new file mode 100644 index 0000000..12d07d1 --- /dev/null +++ b/pkgs/overlays/cosmic-packages.nix @@ -0,0 +1,33 @@ +{ inputs ? import ../../inputs.nix {}}: + +let + nixos-cosmic = inputs.cosmic-modules; + cosmicPkgsMainDir = builtins.readDir "${nixos-cosmic}/pkgs"; + cosmicPkgsDirs = builtins.filter (v: cosmicPkgsMainDir."${v}" == "directory") (builtins.attrNames cosmicPkgsMainDir); + + # FIXME: use unstable nixpkgs when rust 1.80 will be available in unstable + stagingNixpkgsSrc = builtins.fetchTarball { + name = "nixpkgs"; + url = "https://github.com/NixOS/nixpkgs/archive/b79cec4237cd0f655562890bf927466c68b48d68.tar.gz"; + sha256 = "1mswisq9iwffg2d6rfxvr27mvi4w853d9rn222s2g76445d0iqh8"; + }; + cosmicOverlay = self: super: builtins.listToAttrs ( + builtins.map (v: {name = v; value = self.callPackage "${nixos-cosmic}/pkgs/${v}/package.nix" {};}) cosmicPkgsDirs + ); +in + +self: super: + +let +stagingNixpkgs = import stagingNixpkgsSrc { + localSystem = self.stdenv.buildPlatform; + config = self.config; + overlays = [ cosmicOverlay ]; + } // (if self.stdenv.buildPlatform == self.stdenv.hostPlatform then {} else { + crossSystem = self.stdenv.hostPlatform; + }); +in + +builtins.listToAttrs ( + builtins.map (v: {name = v; value = stagingNixpkgs.${v};}) cosmicPkgsDirs +) From 6b1ea56d8b216c316a8072d8d433d32c05e9a899 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 8 Aug 2024 07:14:07 +0200 Subject: [PATCH 033/218] nixos/cosmic: move overlay and substituters to hosts/vm-cosmic use cosmic-packages overlay --- hosts/vm-cosmic.nix | 10 +++++++++- nix-os/desktopManagers/cosmic.nix | 20 ++------------------ nix-os/displayManagers/cosmic-greeter.nix | 20 ++------------------ 3 files changed, 13 insertions(+), 37 deletions(-) diff --git a/hosts/vm-cosmic.nix b/hosts/vm-cosmic.nix index 00989ab..c842604 100644 --- a/hosts/vm-cosmic.nix +++ b/hosts/vm-cosmic.nix @@ -1,4 +1,4 @@ -{ ... }: +{ inputs, ... }: { imports = [ @@ -6,4 +6,12 @@ ../nix-os/desktopManagers/cosmic.nix ../nix-os/displayManagers/cosmic-greeter.nix ]; + + config = { + nixpkgs.overlays = [(import ../pkgs/overlays/cosmic-packages.nix { inherit inputs; })]; + nix.settings = { + substituters = [ "https://cosmic.cachix.org/" ]; + trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ]; + }; + }; } diff --git a/nix-os/desktopManagers/cosmic.nix b/nix-os/desktopManagers/cosmic.nix index 589ee56..96a1bf3 100644 --- a/nix-os/desktopManagers/cosmic.nix +++ b/nix-os/desktopManagers/cosmic.nix @@ -1,26 +1,10 @@ -{pkgs, lib, ... }: +{ inputs, lib, pkgs, ... }: -let - nixos-cosmic = builtins.fetchGit { - url = "https://github.com/lilyinstarlight/nixos-cosmic.git"; - # rev = "b61e7a0da2fa1d5f05d41e3db6386b2ac5f5079b"; - }; - cosmicPkgsMainDir = builtins.readDir "${nixos-cosmic}/pkgs"; - cosmicPkgsDirs = builtins.filter (v: cosmicPkgsMainDir."${v}" == "directory") (builtins.attrNames cosmicPkgsMainDir); - cosmicPkgsOverlay = final: prev: builtins.listToAttrs ( - builtins.map (v: {name = v; value = final.callPackage "${nixos-cosmic}/pkgs/${v}/package.nix" {};}) cosmicPkgsDirs - ); -in { imports = [ - "${nixos-cosmic}/nixos/cosmic/module.nix" + "${inputs.cosmic-modules}/nixos/cosmic/module.nix" ]; config = { services.desktopManager.cosmic.enable = true; - nixpkgs.overlays = [ cosmicPkgsOverlay ]; - nix.settings = { - substituters = [ "https://cosmic.cachix.org/" ]; - trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ]; - }; }; } diff --git a/nix-os/displayManagers/cosmic-greeter.nix b/nix-os/displayManagers/cosmic-greeter.nix index da54a6d..e39ab93 100644 --- a/nix-os/displayManagers/cosmic-greeter.nix +++ b/nix-os/displayManagers/cosmic-greeter.nix @@ -1,26 +1,10 @@ -{pkgs, lib, ... }: +{ inputs, lib, pkgs, ... }: -let - nixos-cosmic = builtins.fetchGit { - url = "https://github.com/lilyinstarlight/nixos-cosmic.git"; - # rev = "b61e7a0da2fa1d5f05d41e3db6386b2ac5f5079b"; - }; - cosmicPkgsMainDir = builtins.readDir "${nixos-cosmic}/pkgs"; - cosmicPkgsDirs = builtins.filter (v: cosmicPkgsMainDir."${v}" == "directory") (builtins.attrNames cosmicPkgsMainDir); - cosmicPkgsOverlay = final: prev: builtins.listToAttrs ( - builtins.map (v: {name = v; value = final.callPackage "${nixos-cosmic}/pkgs/${v}/package.nix" {};}) cosmicPkgsDirs - ); -in { imports = [ - "${nixos-cosmic}/nixos/cosmic-greeter/module.nix" + "${inputs.cosmic-modules}/nixos/cosmic-greeter/module.nix" ]; config = { services.displayManager.cosmic-greeter.enable = true; - nixpkgs.overlays = [ cosmicPkgsOverlay ]; - nix.settings = { - substituters = [ "https://cosmic.cachix.org/" ]; - trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ]; - }; }; } From f5f02b7e76952be692c1e7d20f3cc864f5b1d527 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 8 Aug 2024 09:22:37 +0200 Subject: [PATCH 034/218] nixos/core-desktop: specify Meslo in nerdfonts --- nix-os/core-desktop.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix index 81725dd..1e6a8d1 100644 --- a/nix-os/core-desktop.nix +++ b/nix-os/core-desktop.nix @@ -28,7 +28,7 @@ # Fonts fonts.packages = with pkgs; [ corefonts - nerdfonts + (nerdfonts.override { fonts = [ "Meslo" ]; }) roboto ]; }; From 99a59bfb6b3edfa1ee0e75156521b3eddd15e651 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 8 Aug 2024 16:47:36 +0200 Subject: [PATCH 035/218] pkgs/overlay/cosmic-packages: build cosmic using locked nixpkgs but with future rust cosmic didn't work at all when I just made it using futureNixpkgs. --- pkgs/overlays/cosmic-packages.nix | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/pkgs/overlays/cosmic-packages.nix b/pkgs/overlays/cosmic-packages.nix index 12d07d1..1722c18 100644 --- a/pkgs/overlays/cosmic-packages.nix +++ b/pkgs/overlays/cosmic-packages.nix @@ -1,5 +1,7 @@ { inputs ? import ../../inputs.nix {}}: +self: super: + let nixos-cosmic = inputs.cosmic-modules; cosmicPkgsMainDir = builtins.readDir "${nixos-cosmic}/pkgs"; @@ -11,15 +13,26 @@ let url = "https://github.com/NixOS/nixpkgs/archive/b79cec4237cd0f655562890bf927466c68b48d68.tar.gz"; sha256 = "1mswisq9iwffg2d6rfxvr27mvi4w853d9rn222s2g76445d0iqh8"; }; - cosmicOverlay = self: super: builtins.listToAttrs ( - builtins.map (v: {name = v; value = self.callPackage "${nixos-cosmic}/pkgs/${v}/package.nix" {};}) cosmicPkgsDirs + + # Take rustPackages from staging nixpkgs + stagingNixpkgs = import stagingNixpkgsSrc { + localSystem = self.stdenv.buildPlatform; + config = self.config; + } // (if self.stdenv.buildPlatform == self.stdenv.hostPlatform then {} else { + crossSystem = self.stdenv.hostPlatform; + }); + futureRustPackages = stagingNixpkgs.rustPackages; + + # Create nixpkgs with future rust + nixpkgsWithFutureRust = self.extend (futureSelf: futureSuper: { + rustPackages = futureRustPackages; + }); + + # Create cosmicPkgs that contains cosmic packages built from nixpkgs with future rust + cosmicOverlay = cosmicSelf: cosmicSuper: builtins.listToAttrs ( + builtins.map (v: {name = v; value = nixpkgsWithFutureRust.callPackage "${nixos-cosmic}/pkgs/${v}/package.nix" {};}) cosmicPkgsDirs ); -in - -self: super: - -let -stagingNixpkgs = import stagingNixpkgsSrc { + cosmicNixpkgs = import inputs.nixpkgs { localSystem = self.stdenv.buildPlatform; config = self.config; overlays = [ cosmicOverlay ]; @@ -29,5 +42,5 @@ stagingNixpkgs = import stagingNixpkgsSrc { in builtins.listToAttrs ( - builtins.map (v: {name = v; value = stagingNixpkgs.${v};}) cosmicPkgsDirs + builtins.map (v: {name = v; value = cosmicNixpkgs.${v};}) cosmicPkgsDirs ) From f85b7d92118c6b6cf32a4ddca756341950a3a158 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 8 Aug 2024 16:49:01 +0200 Subject: [PATCH 036/218] hosts/vm-base: add core-destkop --- hosts/vm-base.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts/vm-base.nix b/hosts/vm-base.nix index 1f3b796..1e57e16 100644 --- a/hosts/vm-base.nix +++ b/hosts/vm-base.nix @@ -5,6 +5,7 @@ "${modulesPath}/virtualisation/qemu-vm.nix" ../nix-os/account.nix ../nix-os/core.nix + ../nix-os/core-desktop.nix ../nix-os/locale.nix ../nix-os/polkit/disable-shutdown.nix ../nix-os/shell.nix From 164ceef1665dfe267520cde19a0bc91b200ea984 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 16 Aug 2024 16:44:45 +0200 Subject: [PATCH 037/218] lock: update cosmic-modules --- lock.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lock.nix b/lock.nix index 28a61ca..7ade0ff 100644 --- a/lock.nix +++ b/lock.nix @@ -8,7 +8,7 @@ sha256 = "01axrf25mahbxmp6vgfgx09dflbyaavr5liynkp6rpm4lkacr27f"; }; cosmic-modules = { - revision = "d8b2b9aee034c10ca67848653171f576f87434a8"; - sha256 = "03i8smxgx2fdb9kkys81dihb5yja3nk9wjs1rx5h7f3b5kii1fd7"; + revision = "7d3dd56cca20e409261ff8c69867d38376f7ecae"; + sha256 = "06i1gqwgrpcarmkszcnblx02804n86424sklw4mva0p47j9n7gww"; }; } From 26566f97ddde1d717bd4d52b5bd278d2ea25d787 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 16 Aug 2024 16:45:13 +0200 Subject: [PATCH 038/218] pkgs/mkScriptOverride: support for default name from path --- pkgs/by-name/mk/mkScriptOverride/package.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/mk/mkScriptOverride/package.nix b/pkgs/by-name/mk/mkScriptOverride/package.nix index 6777a0c..e71d07c 100644 --- a/pkgs/by-name/mk/mkScriptOverride/package.nix +++ b/pkgs/by-name/mk/mkScriptOverride/package.nix @@ -11,7 +11,9 @@ lib.hiPrio (stdenv.mkDerivation ( { src = src; - name = "${src.name}-script-override"; + name = if lib.isDerivation src + then "${src.name}-script-override" + else "${builtins.baseNameOf src}-script-override"; phases = [ "installPhase" "scriptOverridePhase" ]; installPhase = '' runHook preInstall From ccb08c76c88c1761566e6812830255494568ce8d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 16 Aug 2024 16:45:37 +0200 Subject: [PATCH 039/218] pkgs/mkScriptOverride: change attributes to remove to proper ones from argument set --- pkgs/by-name/mk/mkScriptOverride/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/mk/mkScriptOverride/package.nix b/pkgs/by-name/mk/mkScriptOverride/package.nix index e71d07c..0b71a07 100644 --- a/pkgs/by-name/mk/mkScriptOverride/package.nix +++ b/pkgs/by-name/mk/mkScriptOverride/package.nix @@ -25,7 +25,7 @@ lib.hiPrio (stdenv.mkDerivation ( ''; scriptOverridePhase = script; } // lib.removeAttrs args [ - "pkg" - "commands" + "src" + "script" ] )) From 2012c6e33b2997ba8d1add0460812605f0533377 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 16 Aug 2024 16:49:18 +0200 Subject: [PATCH 040/218] lock: update nixpkgs --- lock.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lock.nix b/lock.nix index 7ade0ff..cf13477 100644 --- a/lock.nix +++ b/lock.nix @@ -4,8 +4,8 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "883180e6550c1723395a3a342f830bfc5c371f6b"; - sha256 = "01axrf25mahbxmp6vgfgx09dflbyaavr5liynkp6rpm4lkacr27f"; + revision = "c3d4ac725177c030b1e289015989da2ad9d56af0"; + sha256 = "1n3dm76ip39zgw75jjn8ak9yp25m02ya1mzzg3764yfqq4jz18mj"; }; cosmic-modules = { revision = "7d3dd56cca20e409261ff8c69867d38376f7ecae"; From b8aba059e6166453b5e50479f3e0034fbad1e31f Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 16 Aug 2024 16:55:14 +0200 Subject: [PATCH 041/218] pkgs/overlays/cosmic-packages: update staging nixpkgs pin to current unstable --- pkgs/overlays/cosmic-packages.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/overlays/cosmic-packages.nix b/pkgs/overlays/cosmic-packages.nix index 1722c18..8f2cff8 100644 --- a/pkgs/overlays/cosmic-packages.nix +++ b/pkgs/overlays/cosmic-packages.nix @@ -7,21 +7,21 @@ let cosmicPkgsMainDir = builtins.readDir "${nixos-cosmic}/pkgs"; cosmicPkgsDirs = builtins.filter (v: cosmicPkgsMainDir."${v}" == "directory") (builtins.attrNames cosmicPkgsMainDir); - # FIXME: use unstable nixpkgs when rust 1.80 will be available in unstable - stagingNixpkgsSrc = builtins.fetchTarball { + # Pinned unstable nixpkgs + futureNixpkgsSrc = builtins.fetchTarball { name = "nixpkgs"; - url = "https://github.com/NixOS/nixpkgs/archive/b79cec4237cd0f655562890bf927466c68b48d68.tar.gz"; - sha256 = "1mswisq9iwffg2d6rfxvr27mvi4w853d9rn222s2g76445d0iqh8"; + url = "https://github.com/NixOS/nixpkgs/archive/c3aa7b8938b17aebd2deecf7be0636000d62a2b9.tar.gz"; + sha256 = "1ds3yjcy52l8d3rkxr3b7h9c0c3nly079bgakjaasnfjj3xprrwr"; }; # Take rustPackages from staging nixpkgs - stagingNixpkgs = import stagingNixpkgsSrc { + futureNixpkgs = import futureNixpkgsSrc { localSystem = self.stdenv.buildPlatform; config = self.config; } // (if self.stdenv.buildPlatform == self.stdenv.hostPlatform then {} else { crossSystem = self.stdenv.hostPlatform; }); - futureRustPackages = stagingNixpkgs.rustPackages; + futureRustPackages = futureNixpkgs.rustPackages; # Create nixpkgs with future rust nixpkgsWithFutureRust = self.extend (futureSelf: futureSuper: { From f47db28aa2c5961d6afa066e22ff45565a2b7b41 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 16 Aug 2024 17:00:49 +0200 Subject: [PATCH 042/218] nixos/cosmic: remove cosmic terminal and editor --- nix-os/desktopManagers/cosmic.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nix-os/desktopManagers/cosmic.nix b/nix-os/desktopManagers/cosmic.nix index 96a1bf3..fa1d7d0 100644 --- a/nix-os/desktopManagers/cosmic.nix +++ b/nix-os/desktopManagers/cosmic.nix @@ -6,5 +6,9 @@ ]; config = { services.desktopManager.cosmic.enable = true; + environment.cosmic.excludePackages = with pkgs; [ + cosmic-edit + cosmic-term + ]; }; } From 8169b330ea643e9886fe25253c014f5a5f03536d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 17 Aug 2024 00:20:21 +0200 Subject: [PATCH 043/218] nixos/gnome: set color for pop-shell focus indicator --- nix-os/dconf-common.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/dconf-common.nix b/nix-os/dconf-common.nix index 967d28f..b432971 100644 --- a/nix-os/dconf-common.nix +++ b/nix-os/dconf-common.nix @@ -92,6 +92,7 @@ active-hint-border-radius = mkUint32 1; gap-inner = mkUint32 2; gap-outer = mkUint32 1; + hint-color-rgba = "rgb(161,192,235)"; show-skip-taskbar = true; show-title = true; smart-gaps = false; From ac947fa32234bb764a4593310778e38e52651e57 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 17 Aug 2024 00:23:25 +0200 Subject: [PATCH 044/218] nixos/gnome: disable menus extensions --- nix-os/dconf-common.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/nix-os/dconf-common.nix b/nix-os/dconf-common.nix index b432971..a72aff8 100644 --- a/nix-os/dconf-common.nix +++ b/nix-os/dconf-common.nix @@ -59,8 +59,6 @@ "workspace-indicator@gnome-shell-extensions.gcampax.github.com" "Vitals@CoreCoding.com" "trayIconsReloaded@selfmade.pl" - "places-menu@gnome-shell-extensions.gcampax.github.com" - "apps-menu@gnome-shell-extensions.gcampax.github.com" "top-bar-organizer@julian.gse.jsts.xyz" "color-picker@tuberry" ]; From a4adeaa674fffdd9c55ce9d9db3c0b568eb434db Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 24 Aug 2024 00:16:37 +0200 Subject: [PATCH 045/218] nixos/account: add jitsi meet desktop app --- nix-os/account.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/account.nix b/nix-os/account.nix index e7bb85c..8f6559c 100644 --- a/nix-os/account.nix +++ b/nix-os/account.nix @@ -24,6 +24,7 @@ unstablePkgs.vscode gimp inkscape + jitsi-meet-electron krita unstablePkgs.zettlr ]; From dabc5155c3a3a9eaa4335e964c4357059663fda2 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 8 Sep 2024 20:22:19 +0200 Subject: [PATCH 046/218] nixos/core: enable no-url-literals experiment --- nix-os/core.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nix-os/core.nix b/nix-os/core.nix index 53eaab8..41a4cc7 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -34,6 +34,9 @@ in nix = { package = wrappedNix; channel.enable = false; + settings.experimental-features = [ + "no-url-literals" + ]; settings.nix-path = [ "nixpkgs=${pkgs.selfExpr { useConfig = false; }}" "systemNixpkgs=${pkgs.selfExpr { useConfig = true; name = "systemNixpkgs-self"; }}" From 1b8cd49a5791a773f5bf592bb8bf110732924d43 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 8 Sep 2024 22:34:57 +0200 Subject: [PATCH 047/218] lock: update nixpkgs --- lock.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lock.nix b/lock.nix index cf13477..a978fc5 100644 --- a/lock.nix +++ b/lock.nix @@ -4,8 +4,8 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "c3d4ac725177c030b1e289015989da2ad9d56af0"; - sha256 = "1n3dm76ip39zgw75jjn8ak9yp25m02ya1mzzg3764yfqq4jz18mj"; + revision = "68e7dce0a6532e876980764167ad158174402c6f"; + sha256 = "024vd8hqdakvhyzxw6zpm6awkxm9bx0xg5hmrpsfl16nnrwy3z34"; }; cosmic-modules = { revision = "7d3dd56cca20e409261ff8c69867d38376f7ecae"; From 8d77a593890df4a99e32bdd599088f3c601cff23 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 9 Sep 2024 19:47:35 +0200 Subject: [PATCH 048/218] nixos/services/nix-binary-cache: use nix-serve-ng --- nix-os/services/nix-binary-cache.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nix-os/services/nix-binary-cache.nix b/nix-os/services/nix-binary-cache.nix index aaff003..923b0bc 100644 --- a/nix-os/services/nix-binary-cache.nix +++ b/nix-os/services/nix-binary-cache.nix @@ -1,7 +1,10 @@ +{ pkgs, ... }: + { config = { services.nix-serve = { enable = true; + package = pkgs.nix-serve-ng; secretKeyFile = "/var/cache-priv-key.pem"; }; }; From eb3119d34ddaa94914a165cbeef6a45684de6eae Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 9 Sep 2024 20:31:54 +0200 Subject: [PATCH 049/218] nixos/desktop: use pcmanfm for desktop installations --- nix-os/core-desktop.nix | 1 + nix-os/dconf-common.nix | 1 + nix-os/desktopManagers/cosmic.nix | 1 + nix-os/desktopManagers/gnome.nix | 1 + 4 files changed, 4 insertions(+) diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix index 1e6a8d1..853e8f6 100644 --- a/nix-os/core-desktop.nix +++ b/nix-os/core-desktop.nix @@ -19,6 +19,7 @@ environment.systemPackages = with pkgs; [ mpv + pcmanfm ]; services.openssh.extraConfig = '' diff --git a/nix-os/dconf-common.nix b/nix-os/dconf-common.nix index a72aff8..0f8c1e4 100644 --- a/nix-os/dconf-common.nix +++ b/nix-os/dconf-common.nix @@ -64,6 +64,7 @@ ]; favorite-apps = [ "kitty.desktop" + "pcmanfm.desktop" "vivaldi-stable.desktop" "code.desktop" "org.gnome.Nautilus.desktop" diff --git a/nix-os/desktopManagers/cosmic.nix b/nix-os/desktopManagers/cosmic.nix index fa1d7d0..902c435 100644 --- a/nix-os/desktopManagers/cosmic.nix +++ b/nix-os/desktopManagers/cosmic.nix @@ -9,6 +9,7 @@ environment.cosmic.excludePackages = with pkgs; [ cosmic-edit cosmic-term + cosmic-files ]; }; } diff --git a/nix-os/desktopManagers/gnome.nix b/nix-os/desktopManagers/gnome.nix index f3512b5..964b906 100644 --- a/nix-os/desktopManagers/gnome.nix +++ b/nix-os/desktopManagers/gnome.nix @@ -68,6 +68,7 @@ in gnome.seahorse gnome.totem gnome.yelp + gnome.nautilus ]; environment.systemPackages = with pkgs; [ From 6c64393312b677905adf15de45d82289d9b73fef Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 10 Sep 2024 02:06:42 +0200 Subject: [PATCH 050/218] outputs: use 'outPath' instead of '__toString' for selfPath --- outputs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.nix b/outputs.nix index f69f3bf..d5fdeb7 100644 --- a/outputs.nix +++ b/outputs.nix @@ -9,7 +9,7 @@ lib = (import "${inputs.nixpkgs}/lib").extend (import ./lib/overlays/version-inf self = { inherit inputs lib self; - __toString = _: selfPath; + outPath = selfPath; modifiedNixpkgs = import ./pkgs/top-level/impure.nix; modifiedNixpkgsPure = import ./pkgs/top-level/default.nix; overlays = { From c188003188d714feaefba65fce0c49cbea0098de Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 14 Sep 2024 01:49:58 +0200 Subject: [PATCH 051/218] nixos/gnome: set theme for gtk-3 apps --- nix-os/desktopManagers/gnome.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nix-os/desktopManagers/gnome.nix b/nix-os/desktopManagers/gnome.nix index 964b906..f13c706 100644 --- a/nix-os/desktopManagers/gnome.nix +++ b/nix-os/desktopManagers/gnome.nix @@ -81,8 +81,14 @@ in # unstablePkgs.gnomeExtensions.translate-indicator # translate-shell pavucontrol - #FIXME: Apply the cursor theme also in GTK3 config google-cursor ]; + + environment.etc."xdg/gtk-3.0/settings.ini".text = '' + [Settings] + gtk-cursor-theme-name=${config.proot.dconf.rules."org/gnome/desktop/interface".cursor-theme} + '' + lib.optionalString (lib.hasInfix "dark" config.proot.dconf.rules."org/gnome/desktop/interface".color-scheme) '' + gtk-application-prefer-dark-theme=true + ''; }; } From f7e48890cde24463f584c973cce80cfce2f2caa1 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 14 Sep 2024 19:47:41 +0200 Subject: [PATCH 052/218] pkgs/overlays/unstable: factor out adding unstable package set to different file --- pkgs/overlays/unstable-from-source.nix | 30 ++++++++++++++++++++++++++ pkgs/overlays/unstable.nix | 22 +++---------------- 2 files changed, 33 insertions(+), 19 deletions(-) create mode 100644 pkgs/overlays/unstable-from-source.nix diff --git a/pkgs/overlays/unstable-from-source.nix b/pkgs/overlays/unstable-from-source.nix new file mode 100644 index 0000000..128da58 --- /dev/null +++ b/pkgs/overlays/unstable-from-source.nix @@ -0,0 +1,30 @@ +{ + unstableSource, +}: + +self: super: + +let + useUnstable = self.config.useUnstable or true; + + unstablePkgsForNixpkgs = nixpkgs: import unstableSource { + # localSystem -> pkgs.stdenv.buildPlatform + localSystem = nixpkgs.stdenv.buildPlatform; + # crossSystem -> pkgs.stdenv.hostPlatform or pkgs.stdenv.targetPlatform ?? + # passing below + # config -> pkgs.config + config = nixpkgs.config; + # overlays -> partial of pkgs.overlays + overlays = nixpkgs.overlays; + # crossOverlays -> partial of pkgs.overlays + # crossOverlays are merged to overlays, not sure what issues that might raise. + # ignoring. + } // (if nixpkgs.stdenv.buildPlatform == nixpkgs.stdenv.hostPlatform then {} else { + # workaround for some odd structured packages that changes behaviour + # when crossSystem is passed. + crossSystem = nixpkgs.stdenv.hostPlatform; + }); +in +{ + unstable = if useUnstable then unstablePkgsForNixpkgs self else self; +} diff --git a/pkgs/overlays/unstable.nix b/pkgs/overlays/unstable.nix index 1cf4bae..297b3ae 100644 --- a/pkgs/overlays/unstable.nix +++ b/pkgs/overlays/unstable.nix @@ -24,26 +24,10 @@ let ]; nixpkgsRevision = (builtins.readFile "${unstablePkgsExprs}/.git-revision"); - unstablePkgsForNixpkgs = nixpkgs: import unstablePkgsExprs { - # localSystem -> pkgs.stdenv.buildPlatform - localSystem = nixpkgs.stdenv.buildPlatform; - # crossSystem -> pkgs.stdenv.hostPlatform or pkgs.stdenv.targetPlatform ?? - # passing below - # config -> pkgs.config - config = nixpkgs.config; - # overlays -> partial of pkgs.overlays - overlays = nixpkgs.overlays; - # crossOverlays -> partial of pkgs.overlays - # crossOverlays are merged to overlays, not sure what issues that might raise. - # ignoring. - } // (if nixpkgs.stdenv.buildPlatform == nixpkgs.stdenv.hostPlatform then {} else { - # workaround for some odd structured packages that changes behaviour - # when crossSystem is passed. - crossSystem = nixpkgs.stdenv.hostPlatform; - }); in -{ - unstable = if useUnstable then unstablePkgsForNixpkgs self else self; +import ./unstable-from-source.nix { + unstableSource = unstablePkgsExprs; +} self super // { unstableVersion = self.lib.optionalString useUnstable nixpkgsVersion; unstableRevision = self.lib.optionalString useUnstable nixpkgsRevision; } From d4e7760eb8210a6f2735eb90735f1f76c1c01294 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 14 Sep 2024 19:49:32 +0200 Subject: [PATCH 053/218] pkgs/overlays/unstable-from-source: remove "emulator" attribute from forwarded platform https://github.com/NixOS/nixpkgs/pull/324071 broke the overlay --- pkgs/overlays/unstable-from-source.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/overlays/unstable-from-source.nix b/pkgs/overlays/unstable-from-source.nix index 128da58..afb8f2e 100644 --- a/pkgs/overlays/unstable-from-source.nix +++ b/pkgs/overlays/unstable-from-source.nix @@ -6,10 +6,14 @@ self: super: let useUnstable = self.config.useUnstable or true; + sanitizePlatform = platformConfig: self.lib.removeAttrs platformConfig [ + "emulator" + "emulatorAvailable" + ]; unstablePkgsForNixpkgs = nixpkgs: import unstableSource { # localSystem -> pkgs.stdenv.buildPlatform - localSystem = nixpkgs.stdenv.buildPlatform; + localSystem = sanitizePlatform nixpkgs.stdenv.buildPlatform; # crossSystem -> pkgs.stdenv.hostPlatform or pkgs.stdenv.targetPlatform ?? # passing below # config -> pkgs.config @@ -22,7 +26,7 @@ let } // (if nixpkgs.stdenv.buildPlatform == nixpkgs.stdenv.hostPlatform then {} else { # workaround for some odd structured packages that changes behaviour # when crossSystem is passed. - crossSystem = nixpkgs.stdenv.hostPlatform; + crossSystem = sanitizePlatform nixpkgs.stdenv.hostPlatform; }); in { From d543c41694fca95a5e0a3bc1f2b952cc68a11374 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 14 Sep 2024 19:51:36 +0200 Subject: [PATCH 054/218] pkgs/overlays/unstable: remove fetching using unstableRevision options use unstable-from-source overlay instead --- pkgs/overlays/unstable.nix | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/pkgs/overlays/unstable.nix b/pkgs/overlays/unstable.nix index 297b3ae..73e79b9 100644 --- a/pkgs/overlays/unstable.nix +++ b/pkgs/overlays/unstable.nix @@ -2,18 +2,9 @@ self: super: let nixos = self.config.nixos or true; - unstableRevision = self.config.unstableRevision or null; - unstableRevisionHash = self.config.unstableRevisionHash or null; useUnstable = self.config.useUnstable or true; - unstablePkgsExprs = if !builtins.isNull unstableRevision - then if !builtins.isNull unstableRevisionHash - then builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/${unstableRevision}.tar.gz"; - sha256 = unstableRevisionHash; - } - else builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/${unstableRevision}.tar.gz" - else if nixos + unstablePkgsExprs = if nixos then builtins.fetchTarball "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz" else builtins.fetchTarball "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; From 72f3d202102794b4e760e911dc9a641eef907792 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 16 Sep 2024 10:45:08 +0200 Subject: [PATCH 055/218] nixos/polkit/network: create and allow to manage wireguard client services --- nix-os/polkit/network.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 nix-os/polkit/network.nix diff --git a/nix-os/polkit/network.nix b/nix-os/polkit/network.nix new file mode 100644 index 0000000..76d559f --- /dev/null +++ b/nix-os/polkit/network.nix @@ -0,0 +1,16 @@ +{ + config = { + security.polkit.extraConfig = '' + polkit.addRule(function(action, subject) { + // Allow to start and stop wireguard client services + if ( + action.id == "org.freedesktop.systemd1.manage-units" && + action.lookup("unit") && + action.lookup("unit").match(/^wg-quick-.*\.service$/) + ) { + return polkit.Result.YES; + }; + }); + ''; + }; +} From 4db494a73c8dfaf50cc7b80509068caeeb06a4f3 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 19 Sep 2024 10:53:25 +0200 Subject: [PATCH 056/218] hosts/tablet: use polkit/nework module --- hosts/tablet.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts/tablet.nix b/hosts/tablet.nix index ad06d9b..a9f656a 100644 --- a/hosts/tablet.nix +++ b/hosts/tablet.nix @@ -9,6 +9,7 @@ ../nix-os/locale.nix ../nix-os/shell.nix ../nix-os/gnupg.nix + ../nix-os/polkit/network.nix ../nix-os/desktopManagers/gnome.nix ../nix-os/displayManagers/gdm.nix From 95bdbc6e8c2eb8782dd3b854902defcf28b872ab Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 19 Sep 2024 10:53:41 +0200 Subject: [PATCH 057/218] nixos/account: add telegram package --- nix-os/account.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/account.nix b/nix-os/account.nix index 8f6559c..492f09f 100644 --- a/nix-os/account.nix +++ b/nix-os/account.nix @@ -26,6 +26,7 @@ inkscape jitsi-meet-electron krita + telegram-desktop unstablePkgs.zettlr ]; }; From a20caabad61fb794dffe2af28b82bfc51d16e4ee Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 29 Sep 2024 22:32:34 +0200 Subject: [PATCH 058/218] nixos/core-desktop: add pcmanfm configuration I don't expect it to be fully working (pcmanfm.conf), but I had it uncommited oops --- nix-os/core-desktop.nix | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix index 853e8f6..ee01bff 100644 --- a/nix-os/core-desktop.nix +++ b/nix-os/core-desktop.nix @@ -32,5 +32,71 @@ (nerdfonts.override { fonts = [ "Meslo" ]; }) roboto ]; + + # Pcmanfm configuration + environment.etc."xdg/pcmanfm/default/pcmanfm.conf".text = '' + [config] + bm_open_method=0 + + [volume] + mount_on_startup=0 + mount_removable=0 + autorun=0 + + [ui] + always_show_tabs=1 + max_tab_chars=32 + media_in_new_tab=0 + desktop_folder_new_win=0 + change_tab_on_drop=1 + close_on_unmount=1 + focus_previous=1 + side_pane_mode=places + view_mode=list + show_hidden=1 + sort=name;ascending; + toolbar=newwin;newtab;navigation;home; + show_statusbar=1 + pathbar_mode_buttons=0 + ''; + + environment.etc."xdg/libfm/libfm.conf".text = '' + [config] + single_click=0 + use_trash=1 + confirm_del=1 + confirm_trash=1 + advanced_mode=0 + si_unit=0 + force_startup_notify=1 + backup_as_hidden=1 + no_usb_trash=1 + no_child_non_expandable=0 + show_full_names=0 + only_user_templates=0 + drop_default_action=auto + terminal=${lib.optionalString (lib.elem pkgs.kitty config.environment.systemPackages) "kitty"} + archiver=file-roller + thumbnail_local=1 + thumbnail_max=16384 + + [ui] + big_icon_size=48 + small_icon_size=16 + pane_icon_size=16 + thumbnail_size=128 + show_thumbnail=1 + shadow_hidden=1 + + [places] + places_home=1 + places_desktop=1 + places_root=1 + places_computer=1 + places_trash=1 + places_applications=1 + places_network=1 + places_unmounted=1 + ''; }; } From d8ca5aec74c077f1beaf8334c77249bdc9dce919 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 29 Sep 2024 23:06:07 +0200 Subject: [PATCH 059/218] lock: update nixpkgs --- lock.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lock.nix b/lock.nix index a978fc5..228a570 100644 --- a/lock.nix +++ b/lock.nix @@ -4,8 +4,8 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "68e7dce0a6532e876980764167ad158174402c6f"; - sha256 = "024vd8hqdakvhyzxw6zpm6awkxm9bx0xg5hmrpsfl16nnrwy3z34"; + revision = "fbca5e745367ae7632731639de5c21f29c8744ed"; + sha256 = "07wa6y7q4ql0x1jj08dignak2lra003inf2cxl4xxvyqdsspshp3"; }; cosmic-modules = { revision = "7d3dd56cca20e409261ff8c69867d38376f7ecae"; From cce35f8934139225a6cc42f7e6306a6dd0288d7d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 30 Sep 2024 12:25:35 +0200 Subject: [PATCH 060/218] nixos/polkit/network: disallow managing wg-quick services to system accoutns --- nix-os/polkit/network.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/polkit/network.nix b/nix-os/polkit/network.nix index 76d559f..632cacf 100644 --- a/nix-os/polkit/network.nix +++ b/nix-os/polkit/network.nix @@ -5,6 +5,7 @@ // Allow to start and stop wireguard client services if ( action.id == "org.freedesktop.systemd1.manage-units" && + subject.isInGroup("users") && action.lookup("unit") && action.lookup("unit").match(/^wg-quick-.*\.service$/) ) { From e4813107c373b002dbf521745270ac299b3c2d4e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 2 Oct 2024 01:44:58 +0200 Subject: [PATCH 061/218] pkgs/overlays/cosmic-packages: use unstable pinned in upstream. --- pkgs/overlays/cosmic-packages.nix | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkgs/overlays/cosmic-packages.nix b/pkgs/overlays/cosmic-packages.nix index 8f2cff8..4026eae 100644 --- a/pkgs/overlays/cosmic-packages.nix +++ b/pkgs/overlays/cosmic-packages.nix @@ -7,14 +7,18 @@ let cosmicPkgsMainDir = builtins.readDir "${nixos-cosmic}/pkgs"; cosmicPkgsDirs = builtins.filter (v: cosmicPkgsMainDir."${v}" == "directory") (builtins.attrNames cosmicPkgsMainDir); - # Pinned unstable nixpkgs + # Pinned unstable nixpkgs from cosmic-modules + cosmicModulesLock = builtins.fromJSON (builtins.readFile "${nixos-cosmic}/flake.lock"); + pinnedNixpkgsRev = cosmicModulesLock.nodes.nixpkgs.locked.rev; + pinnedNixpkgsNarHash = cosmicModulesLock.nodes.nixpkgs.locked.narHash; + futureNixpkgsSrc = builtins.fetchTarball { name = "nixpkgs"; - url = "https://github.com/NixOS/nixpkgs/archive/c3aa7b8938b17aebd2deecf7be0636000d62a2b9.tar.gz"; - sha256 = "1ds3yjcy52l8d3rkxr3b7h9c0c3nly079bgakjaasnfjj3xprrwr"; + url = "https://github.com/NixOS/nixpkgs/archive/${pinnedNixpkgsRev}.tar.gz"; + sha256 = pinnedNixpkgsNarHash; }; - # Take rustPackages from staging nixpkgs + # Take rustPackages from pinned nixpkgs futureNixpkgs = import futureNixpkgsSrc { localSystem = self.stdenv.buildPlatform; config = self.config; From 667f7d819910f63540ed36f51baf8d39926732b2 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 2 Oct 2024 02:20:46 +0200 Subject: [PATCH 062/218] pkgs/overlays/cosmic-packages: use packages constructor from upstream --- pkgs/overlays/cosmic-packages.nix | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/pkgs/overlays/cosmic-packages.nix b/pkgs/overlays/cosmic-packages.nix index 4026eae..fcaee7b 100644 --- a/pkgs/overlays/cosmic-packages.nix +++ b/pkgs/overlays/cosmic-packages.nix @@ -4,8 +4,6 @@ self: super: let nixos-cosmic = inputs.cosmic-modules; - cosmicPkgsMainDir = builtins.readDir "${nixos-cosmic}/pkgs"; - cosmicPkgsDirs = builtins.filter (v: cosmicPkgsMainDir."${v}" == "directory") (builtins.attrNames cosmicPkgsMainDir); # Pinned unstable nixpkgs from cosmic-modules cosmicModulesLock = builtins.fromJSON (builtins.readFile "${nixos-cosmic}/flake.lock"); @@ -18,33 +16,17 @@ let sha256 = pinnedNixpkgsNarHash; }; - # Take rustPackages from pinned nixpkgs + # Initialize pinned nixpkgs futureNixpkgs = import futureNixpkgsSrc { localSystem = self.stdenv.buildPlatform; config = self.config; } // (if self.stdenv.buildPlatform == self.stdenv.hostPlatform then {} else { crossSystem = self.stdenv.hostPlatform; }); - futureRustPackages = futureNixpkgs.rustPackages; - - # Create nixpkgs with future rust - nixpkgsWithFutureRust = self.extend (futureSelf: futureSuper: { - rustPackages = futureRustPackages; - }); - - # Create cosmicPkgs that contains cosmic packages built from nixpkgs with future rust - cosmicOverlay = cosmicSelf: cosmicSuper: builtins.listToAttrs ( - builtins.map (v: {name = v; value = nixpkgsWithFutureRust.callPackage "${nixos-cosmic}/pkgs/${v}/package.nix" {};}) cosmicPkgsDirs - ); - cosmicNixpkgs = import inputs.nixpkgs { - localSystem = self.stdenv.buildPlatform; - config = self.config; - overlays = [ cosmicOverlay ]; - } // (if self.stdenv.buildPlatform == self.stdenv.hostPlatform then {} else { - crossSystem = self.stdenv.hostPlatform; - }); in -builtins.listToAttrs ( - builtins.map (v: {name = v; value = cosmicNixpkgs.${v};}) cosmicPkgsDirs -) +import "${nixos-cosmic}/pkgs" { + final = self; + prev = super; + rustPlatform = futureNixpkgs.rustPlatform; +} From 7c9d74e561659bd8db18517ada57d5556ad14cd5 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 2 Oct 2024 02:21:08 +0200 Subject: [PATCH 063/218] pkgs/overlays/cosmic-packages: allow to provide own rustPlatform --- pkgs/overlays/cosmic-packages.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/overlays/cosmic-packages.nix b/pkgs/overlays/cosmic-packages.nix index fcaee7b..9b9f6f5 100644 --- a/pkgs/overlays/cosmic-packages.nix +++ b/pkgs/overlays/cosmic-packages.nix @@ -1,4 +1,7 @@ -{ inputs ? import ../../inputs.nix {}}: +{ + inputs ? import ../../inputs.nix {}, + rustPlatform ? null, +}: self: super: @@ -28,5 +31,5 @@ in import "${nixos-cosmic}/pkgs" { final = self; prev = super; - rustPlatform = futureNixpkgs.rustPlatform; + rustPlatform = if rustPlatform != null then rustPlatform else futureNixpkgs.rustPlatform; } From f90a7b4e9a4b166dd7f68403ccf7f1c836b11d83 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 2 Oct 2024 03:29:05 +0200 Subject: [PATCH 064/218] lock: update cosmic-modules --- lock.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lock.nix b/lock.nix index 228a570..b9b5f45 100644 --- a/lock.nix +++ b/lock.nix @@ -8,7 +8,7 @@ sha256 = "07wa6y7q4ql0x1jj08dignak2lra003inf2cxl4xxvyqdsspshp3"; }; cosmic-modules = { - revision = "7d3dd56cca20e409261ff8c69867d38376f7ecae"; - sha256 = "06i1gqwgrpcarmkszcnblx02804n86424sklw4mva0p47j9n7gww"; + revision = "074bbcc4e3fa9ce4bee100de64506c3662c62299"; + sha256 = "0rb0d20i05rjkhk3g5xld46l0ir055mbbbnlic4p3jvbqv9xqiqd"; }; } From af5cb9c7d1001b4079ee8b2b4f605ef2a3d71bdf Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 2 Oct 2024 13:39:38 +0200 Subject: [PATCH 065/218] nixos/polkit/disable-shutdown: allow delaying power actions --- nix-os/polkit/disable-shutdown.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/nix-os/polkit/disable-shutdown.nix b/nix-os/polkit/disable-shutdown.nix index 24571dd..660c32a 100644 --- a/nix-os/polkit/disable-shutdown.nix +++ b/nix-os/polkit/disable-shutdown.nix @@ -15,8 +15,6 @@ action.id == "org.freedesktop.login1.inhibit-block-idle" || action.id == "org.freedesktop.login1.inhibit-block-shutdown" || action.id == "org.freedesktop.login1.inhibit-block-sleep" || - action.id == "org.freedesktop.login1.inhibit-delay-shutdown" || - action.id == "org.freedesktop.login1.inhibit-delay-sleep" || action.id == "org.freedesktop.login1.inhibit-handle-hibernate-key" || action.id == "org.freedesktop.login1.inhibit-handle-lid-switch" || action.id == "org.freedesktop.login1.inhibit-handle-power-key" || From 85fd323785cca0e5eaa2b770a20fb4b4bfe39830 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 2 Oct 2024 18:32:05 +0200 Subject: [PATCH 066/218] nixos/cosmic: add pavucontrol --- nix-os/desktopManagers/cosmic.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nix-os/desktopManagers/cosmic.nix b/nix-os/desktopManagers/cosmic.nix index 902c435..01dd902 100644 --- a/nix-os/desktopManagers/cosmic.nix +++ b/nix-os/desktopManagers/cosmic.nix @@ -11,5 +11,8 @@ cosmic-term cosmic-files ]; + environment.systemPackages = with pkgs; [ + pavucontrol + ]; }; } From 454249c104093e80561cd85c949dbe7fc2fc38b7 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 2 Oct 2024 18:31:10 +0200 Subject: [PATCH 067/218] hosts/vm-base: expose ssh port --- hosts/vm-base.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hosts/vm-base.nix b/hosts/vm-base.nix index 1e57e16..3aac310 100644 --- a/hosts/vm-base.nix +++ b/hosts/vm-base.nix @@ -18,5 +18,8 @@ virtualisation = { memorySize = 4096; }; + virtualisation.forwardPorts = [ + { from = "host"; host.port = 2222; guest.port = 22; } + ]; }; } From 47e0304b6da208b6e93b9ea2e1481c173a970cc5 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 2 Oct 2024 18:38:26 +0200 Subject: [PATCH 068/218] outputs: expose cosmicPackages overlay --- outputs.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/outputs.nix b/outputs.nix index d5fdeb7..3355399 100644 --- a/outputs.nix +++ b/outputs.nix @@ -13,6 +13,7 @@ self = { modifiedNixpkgs = import ./pkgs/top-level/impure.nix; modifiedNixpkgsPure = import ./pkgs/top-level/default.nix; overlays = { + cosmicPackages = import ./pkgs/overlays/cosmic-packages.nix { inherit inputs; }; selfExpr = import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = inputs.nixpkgs; }; unstable = import ./pkgs/overlays/unstable.nix; versionInfoFixup = import ./pkgs/overlays/version-info-fixup.nix { inherit inputs; }; From b2a2bdbd8ad175b4b9877bc08b1019108d5b62f9 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 2 Oct 2024 18:31:47 +0200 Subject: [PATCH 069/218] hosts: use cosmic desktop --- hosts/main/default.nix | 15 ++++++++++++--- hosts/tablet.nix | 13 ++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/hosts/main/default.nix b/hosts/main/default.nix index d35b5bc..62aeacb 100644 --- a/hosts/main/default.nix +++ b/hosts/main/default.nix @@ -1,4 +1,9 @@ -{ inputs, pkgs, ... }: +{ + inputs, + pkgs, + self, + ... +}: { imports = [ @@ -7,8 +12,8 @@ ../../nix-os/nvidia.nix ../../nix-os/docker.nix ../../nix-os/razer.nix - ../../nix-os/desktopManagers/gnome.nix - ../../nix-os/displayManagers/gdm.nix + ../../nix-os/desktopManagers/cosmic.nix + ../../nix-os/displayManagers/cosmic-greeter.nix ../../nix-os/shell.nix ../../nix-os/virtualization.nix ../../nix-os/polkit/disable-shutdown.nix @@ -36,6 +41,10 @@ hplip ]; + nixpkgs.overlays = [ + self.overlays.cosmicPackages + ]; + # nixos-vscode-server module needs this programs.nix-ld.enable = true; services.vscode-server = { diff --git a/hosts/tablet.nix b/hosts/tablet.nix index a9f656a..faf4c2a 100644 --- a/hosts/tablet.nix +++ b/hosts/tablet.nix @@ -1,4 +1,7 @@ -{ config, lib, pkgs, ... }: +{ + self, + ... +}: { imports = [ @@ -11,8 +14,8 @@ ../nix-os/gnupg.nix ../nix-os/polkit/network.nix - ../nix-os/desktopManagers/gnome.nix - ../nix-os/displayManagers/gdm.nix + ../nix-os/desktopManagers/cosmic.nix + ../../nix-os/displayManagers/cosmic-greeter.nix ../nix-os/udev.nix ]; @@ -25,6 +28,10 @@ networking.firewall.enable = true; hardware.sensor.iio.enable = true; + nixpkgs.overlays = [ + self.overlays.cosmicPackages + ]; + networking.firewall.allowedTCPPortRanges = [ # KDE Connect rec { from = 1714; to = from + 50; } From aa94855506d1b7f714f63c069edf245e07cba5e3 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 2 Oct 2024 23:56:34 +0200 Subject: [PATCH 070/218] nixos/cosmic: enable gnome-keyring --- nix-os/desktopManagers/cosmic.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/desktopManagers/cosmic.nix b/nix-os/desktopManagers/cosmic.nix index 01dd902..c863b27 100644 --- a/nix-os/desktopManagers/cosmic.nix +++ b/nix-os/desktopManagers/cosmic.nix @@ -14,5 +14,6 @@ environment.systemPackages = with pkgs; [ pavucontrol ]; + services.gnome.gnome-keyring.enable = true; }; } From fd458e0151d0bf2798003279d23ca3bd16337903 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 3 Oct 2024 00:01:13 +0200 Subject: [PATCH 071/218] hosts/tablet: fix typo in module location --- hosts/tablet.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts/tablet.nix b/hosts/tablet.nix index faf4c2a..949adb3 100644 --- a/hosts/tablet.nix +++ b/hosts/tablet.nix @@ -15,7 +15,7 @@ ../nix-os/polkit/network.nix ../nix-os/desktopManagers/cosmic.nix - ../../nix-os/displayManagers/cosmic-greeter.nix + ../nix-os/displayManagers/cosmic-greeter.nix ../nix-os/udev.nix ]; From 7181b2012cc2b0303559cb9f07d92b0b415fccca Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 3 Oct 2024 19:24:45 +0200 Subject: [PATCH 072/218] hosts/main: enable cudaSupport in nixpkgs --- hosts/main/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hosts/main/default.nix b/hosts/main/default.nix index 62aeacb..4da73cf 100644 --- a/hosts/main/default.nix +++ b/hosts/main/default.nix @@ -44,6 +44,9 @@ nixpkgs.overlays = [ self.overlays.cosmicPackages ]; + nixpkgs.config = { + cudaSupport = true; + }; # nixos-vscode-server module needs this programs.nix-ld.enable = true; From fbf078d33619730a93b6dc34de195c93707b826c Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 4 Oct 2024 22:48:38 +0200 Subject: [PATCH 073/218] nixos/nvidia: use workaround for nvidia ghost display --- nix-os/nvidia.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nix-os/nvidia.nix b/nix-os/nvidia.nix index c166ac5..90c881f 100644 --- a/nix-os/nvidia.nix +++ b/nix-os/nvidia.nix @@ -6,6 +6,10 @@ driSupport = true; driSupport32Bit = true; }; + + # Workaround for nvidia driver ghost display + boot.kernelParams = [ "nvidia_drm.fbdev=1" ]; + services.xserver.videoDrivers = ["nvidia"]; hardware.nvidia = { modesetting.enable = true; From 8b6f8474a45166d8a9d2b10b903836fab5701c5b Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 10 Oct 2024 02:31:33 +0200 Subject: [PATCH 074/218] nixos/cosmic: provide configuration defaults --- .../v1/enable_drag_source | 1 + .../com.system76.CosmicAppList/v1/favorites | 11 ++++++++++ .../v1/filter_top_levels | 1 + .../v1/military_time | 1 + .../v1/show_seconds | 1 + .../com.system76.CosmicBackground/v1/all | 9 ++++++++ .../v1/same-on-all | 1 + .../com.system76.CosmicComp/v1/autotile | 1 + .../v1/autotile_behavior | 1 + .../v1/focus_follows_cursor | 1 + .../v1/focus_follows_cursor_delay | 1 + .../com.system76.CosmicComp/v1/workspaces | 4 ++++ .../com.system76.CosmicPanel.Dock/v1/anchor | 1 + .../v1/anchor_gap | 1 + .../com.system76.CosmicPanel.Dock/v1/autohide | 5 +++++ .../v1/border_radius | 1 + .../v1/exclusive_zone | 1 + .../com.system76.CosmicPanel.Dock/v1/layer | 1 + .../v1/plugins_center | 5 +++++ .../v1/plugins_wings | 1 + .../com.system76.CosmicPanel.Panel/v1/anchor | 1 + .../v1/anchor_gap | 1 + .../com.system76.CosmicPanel.Panel/v1/layer | 1 + .../v1/plugins_center | 3 +++ .../v1/plugins_wings | 14 ++++++++++++ .../v1/custom | 22 +++++++++++++++++++ .../v1/corner_radii | 8 +++++++ .../v1/corner_radii | 8 +++++++ .../com.system76.CosmicTheme.Mode/v1/is_dark | 1 + .../com.system76.CosmicTk/v1/show_maximize | 1 + .../com.system76.CosmicTk/v1/show_minimize | 1 + nix-os/desktopManagers/cosmic.nix | 18 +++++++++++++++ 32 files changed, 128 insertions(+) create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/enable_drag_source create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/favorites create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/filter_top_levels create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppletTime/v1/military_time create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppletTime/v1/show_seconds create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicBackground/v1/all create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicBackground/v1/same-on-all create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/autotile create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/autotile_behavior create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/focus_follows_cursor create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/focus_follows_cursor_delay create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/workspaces create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/anchor create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/anchor_gap create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/autohide create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/border_radius create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/exclusive_zone create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/layer create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/plugins_center create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/plugins_wings create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/anchor create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/anchor_gap create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/layer create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/plugins_center create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/plugins_wings create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicSettings.Shortcuts/v1/custom create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Dark/v1/corner_radii create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Light/v1/corner_radii create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Mode/v1/is_dark create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicTk/v1/show_maximize create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicTk/v1/show_minimize diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/enable_drag_source b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/enable_drag_source new file mode 100644 index 0000000..f32a580 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/enable_drag_source @@ -0,0 +1 @@ +true \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/favorites b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/favorites new file mode 100644 index 0000000..088deb1 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/favorites @@ -0,0 +1,11 @@ +[ + "kitty", + "vivaldi-stable", + "pcmanfm", + "code", + "steam", + "vesktop", + "org.telegram.desktop", + "jitsi-meet-electron", + "pavucontrol", +] diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/filter_top_levels b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/filter_top_levels new file mode 100644 index 0000000..4af1832 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/filter_top_levels @@ -0,0 +1 @@ +None \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppletTime/v1/military_time b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppletTime/v1/military_time new file mode 100644 index 0000000..f32a580 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppletTime/v1/military_time @@ -0,0 +1 @@ +true \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppletTime/v1/show_seconds b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppletTime/v1/show_seconds new file mode 100644 index 0000000..f32a580 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppletTime/v1/show_seconds @@ -0,0 +1 @@ +true \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicBackground/v1/all b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicBackground/v1/all new file mode 100644 index 0000000..c817dfe --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicBackground/v1/all @@ -0,0 +1,9 @@ +( + output: "all", + source: Path("@wallpaper@"), + filter_by_theme: true, + rotation_frequency: 300, + filter_method: Lanczos, + scaling_mode: Zoom, + sampling_method: Alphanumeric, +) diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicBackground/v1/same-on-all b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicBackground/v1/same-on-all new file mode 100644 index 0000000..f32a580 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicBackground/v1/same-on-all @@ -0,0 +1 @@ +true \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/autotile b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/autotile new file mode 100644 index 0000000..f32a580 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/autotile @@ -0,0 +1 @@ +true \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/autotile_behavior b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/autotile_behavior new file mode 100644 index 0000000..bca87fc --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/autotile_behavior @@ -0,0 +1 @@ +PerWorkspace \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/focus_follows_cursor b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/focus_follows_cursor new file mode 100644 index 0000000..f32a580 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/focus_follows_cursor @@ -0,0 +1 @@ +true \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/focus_follows_cursor_delay b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/focus_follows_cursor_delay new file mode 100644 index 0000000..8a32cf7 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/focus_follows_cursor_delay @@ -0,0 +1 @@ +250 \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/workspaces b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/workspaces new file mode 100644 index 0000000..9518393 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/workspaces @@ -0,0 +1,4 @@ +( + workspace_mode: OutputBound, + workspace_layout: Horizontal, +) \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/anchor b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/anchor new file mode 100644 index 0000000..752ed40 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/anchor @@ -0,0 +1 @@ +Bottom \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/anchor_gap b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/anchor_gap new file mode 100644 index 0000000..02e4a84 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/anchor_gap @@ -0,0 +1 @@ +false \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/autohide b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/autohide new file mode 100644 index 0000000..cd1a18b --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/autohide @@ -0,0 +1,5 @@ +Some(( + wait_time: 1000, + transition_time: 200, + handle_size: 4, +)) \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/border_radius b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/border_radius new file mode 100644 index 0000000..1568d2c --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/border_radius @@ -0,0 +1 @@ +@corner_radii_panel@ diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/exclusive_zone b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/exclusive_zone new file mode 100644 index 0000000..02e4a84 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/exclusive_zone @@ -0,0 +1 @@ +false \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/layer b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/layer new file mode 100644 index 0000000..b095f04 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/layer @@ -0,0 +1 @@ +Top \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/plugins_center b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/plugins_center new file mode 100644 index 0000000..2d2d39c --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/plugins_center @@ -0,0 +1,5 @@ +Some([ + "com.system76.CosmicAppList", + "com.system76.CosmicAppletMinimize", + "com.system76.CosmicPanelAppButton", +]) \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/plugins_wings b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/plugins_wings new file mode 100644 index 0000000..4af1832 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Dock/v1/plugins_wings @@ -0,0 +1 @@ +None \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/anchor b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/anchor new file mode 100644 index 0000000..b095f04 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/anchor @@ -0,0 +1 @@ +Top \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/anchor_gap b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/anchor_gap new file mode 100644 index 0000000..02e4a84 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/anchor_gap @@ -0,0 +1 @@ +false \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/layer b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/layer new file mode 100644 index 0000000..b095f04 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/layer @@ -0,0 +1 @@ +Top \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/plugins_center b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/plugins_center new file mode 100644 index 0000000..2434167 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/plugins_center @@ -0,0 +1,3 @@ +Some([ + "com.system76.CosmicAppletTime", +]) \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/plugins_wings b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/plugins_wings new file mode 100644 index 0000000..3d44247 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/plugins_wings @@ -0,0 +1,14 @@ +Some(([ + "com.system76.CosmicPanelAppButton", + "com.system76.CosmicAppletWorkspaces", +], [ + "com.system76.CosmicAppletInputSources", + "com.system76.CosmicAppletStatusArea", + "com.system76.CosmicAppletTiling", + "com.system76.CosmicAppletAudio", + "com.system76.CosmicAppletNetwork", + "com.system76.CosmicAppletBattery", + "com.system76.CosmicAppletNotifications", + "com.system76.CosmicAppletBluetooth", + "com.system76.CosmicAppletPower", +])) \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicSettings.Shortcuts/v1/custom b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicSettings.Shortcuts/v1/custom new file mode 100644 index 0000000..650da7e --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicSettings.Shortcuts/v1/custom @@ -0,0 +1,22 @@ +{ + ( + modifiers: [ + Ctrl, + Alt, + ], + key: "t", + description: Some("Open terminal"), + ): Spawn("kitty"), + ( + modifiers: [ + Super, + Ctrl, + ], + key: "l", + ): System(LockScreen), + ( + modifiers: [ + Super, + ], + ): System(Launcher), +} \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Dark/v1/corner_radii b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Dark/v1/corner_radii new file mode 100644 index 0000000..00aa3ff --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Dark/v1/corner_radii @@ -0,0 +1,8 @@ +( + radius_0: (0.0, 0.0, 0.0, 0.0), + radius_xs: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@), + radius_s: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@), + radius_m: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@), + radius_l: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@), + radius_xl: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@), +) diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Light/v1/corner_radii b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Light/v1/corner_radii new file mode 100644 index 0000000..00aa3ff --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Light/v1/corner_radii @@ -0,0 +1,8 @@ +( + radius_0: (0.0, 0.0, 0.0, 0.0), + radius_xs: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@), + radius_s: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@), + radius_m: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@), + radius_l: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@), + radius_xl: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@), +) diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Mode/v1/is_dark b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Mode/v1/is_dark new file mode 100644 index 0000000..f32a580 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Mode/v1/is_dark @@ -0,0 +1 @@ +true \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTk/v1/show_maximize b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTk/v1/show_maximize new file mode 100644 index 0000000..02e4a84 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTk/v1/show_maximize @@ -0,0 +1 @@ +false \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTk/v1/show_minimize b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTk/v1/show_minimize new file mode 100644 index 0000000..02e4a84 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTk/v1/show_minimize @@ -0,0 +1 @@ +false \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic.nix b/nix-os/desktopManagers/cosmic.nix index c863b27..0e48b72 100644 --- a/nix-os/desktopManagers/cosmic.nix +++ b/nix-os/desktopManagers/cosmic.nix @@ -1,5 +1,22 @@ { inputs, lib, pkgs, ... }: +let + cosmic-configuration = pkgs.substituteAllFiles { + name = "cosmic-configuration"; + src = ./cosmic-config; + files = [ "." ]; # All files + postInstall = '' + mkdir -p $share/share/cosmic + cp -rt $share/share/cosmic $out/* + ''; + outputs = [ "out" "share" ]; + + wallpaper = ../../media/wallpaper.png; + corner_radii_theme = "2.0"; + corner_radii_panel = "2"; + }; +in + { imports = [ "${inputs.cosmic-modules}/nixos/cosmic/module.nix" @@ -13,6 +30,7 @@ ]; environment.systemPackages = with pkgs; [ pavucontrol + (lib.hiPrio cosmic-configuration.share) ]; services.gnome.gnome-keyring.enable = true; }; From 2f2d6162326eb9869baff493d1e98e11d9fd8395 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 10 Oct 2024 03:39:15 +0200 Subject: [PATCH 075/218] lock: update nixpkgs, cosmic-modules --- lock.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lock.nix b/lock.nix index b9b5f45..598d67e 100644 --- a/lock.nix +++ b/lock.nix @@ -4,11 +4,11 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "fbca5e745367ae7632731639de5c21f29c8744ed"; - sha256 = "07wa6y7q4ql0x1jj08dignak2lra003inf2cxl4xxvyqdsspshp3"; + revision = "1bfbbbe5bbf888d675397c66bfdb275d0b99361c"; + sha256 = "0yh9yljqlsaqdrngqksgabh4jsmjl35x3k1dwfvw4p76ahrv8ikb"; }; cosmic-modules = { - revision = "074bbcc4e3fa9ce4bee100de64506c3662c62299"; - sha256 = "0rb0d20i05rjkhk3g5xld46l0ir055mbbbnlic4p3jvbqv9xqiqd"; + revision = "a8960f9c66a0c4f2c24ae029da0886df4a68af33"; + sha256 = "0l6y68pkrvh4iv2b5nj8drnlyxyvv0zkvk6r9zq3alfvmzwbqp2q"; }; } From 1740dad460b1d9b047b16467cac88169c87ae92d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 10 Oct 2024 08:32:02 +0200 Subject: [PATCH 076/218] nixos/cosmic: Fix missing required dependency current unstable cosmic desktop requires cosmic files to be present --- .../cosmic-config/com.system76.CosmicFiles/v1/desktop | 5 +++++ nix-os/desktopManagers/cosmic.nix | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicFiles/v1/desktop diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicFiles/v1/desktop b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicFiles/v1/desktop new file mode 100644 index 0000000..18697b8 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicFiles/v1/desktop @@ -0,0 +1,5 @@ +( + show_content: false, + show_mounted_drives: false, + show_trash: false, +) \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic.nix b/nix-os/desktopManagers/cosmic.nix index 0e48b72..01e6b5d 100644 --- a/nix-os/desktopManagers/cosmic.nix +++ b/nix-os/desktopManagers/cosmic.nix @@ -26,7 +26,6 @@ in environment.cosmic.excludePackages = with pkgs; [ cosmic-edit cosmic-term - cosmic-files ]; environment.systemPackages = with pkgs; [ pavucontrol From 2686d0f8ac9c8b5609b44e9dde1e44a54f74252b Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 13 Oct 2024 01:31:30 +0200 Subject: [PATCH 077/218] nixos/cosmic: lower active hint size and gaps between/around application windows --- .../cosmic-config/com.system76.CosmicTheme.Dark/v1/active_hint | 1 + .../cosmic-config/com.system76.CosmicTheme.Dark/v1/gaps | 1 + .../cosmic-config/com.system76.CosmicTheme.Light/v1/active_hint | 1 + .../cosmic-config/com.system76.CosmicTheme.Light/v1/gaps | 1 + 4 files changed, 4 insertions(+) create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Dark/v1/active_hint create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Dark/v1/gaps create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Light/v1/active_hint create mode 100644 nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Light/v1/gaps diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Dark/v1/active_hint b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Dark/v1/active_hint new file mode 100644 index 0000000..d8263ee --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Dark/v1/active_hint @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Dark/v1/gaps b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Dark/v1/gaps new file mode 100644 index 0000000..7ed1e48 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Dark/v1/gaps @@ -0,0 +1 @@ +(0, 4) \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Light/v1/active_hint b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Light/v1/active_hint new file mode 100644 index 0000000..d8263ee --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Light/v1/active_hint @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Light/v1/gaps b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Light/v1/gaps new file mode 100644 index 0000000..7ed1e48 --- /dev/null +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicTheme.Light/v1/gaps @@ -0,0 +1 @@ +(0, 4) \ No newline at end of file From 236bedbcb5a99c6cd0ba60c381796fa9a6354be1 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 13 Oct 2024 18:46:09 +0200 Subject: [PATCH 078/218] nixos/core-desktop: add kdeconnect --- nix-os/core-desktop.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix index ee01bff..3158287 100644 --- a/nix-os/core-desktop.nix +++ b/nix-os/core-desktop.nix @@ -18,6 +18,7 @@ }; environment.systemPackages = with pkgs; [ + kdePackages.kdeconnect-kde mpv pcmanfm ]; From bdf87133147eb46c915d30eb72f19fed2b5afa8a Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 14 Oct 2024 02:33:30 +0200 Subject: [PATCH 079/218] nixos/cosmic: add ToggleSticky shortcut --- .../com.system76.CosmicSettings.Shortcuts/v1/custom | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicSettings.Shortcuts/v1/custom b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicSettings.Shortcuts/v1/custom index 650da7e..6c6d1b7 100644 --- a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicSettings.Shortcuts/v1/custom +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicSettings.Shortcuts/v1/custom @@ -19,4 +19,11 @@ Super, ], ): System(Launcher), -} \ No newline at end of file + ( + modifiers: [ + Super, + Alt, + ], + key: "g", + ): ToggleSticky, +} From 735ebc61106b7f25d42db1b5a42cad843a644fb1 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 18 Oct 2024 14:24:15 +0200 Subject: [PATCH 080/218] nixos/core: inherit meta in wrappedNix --- nix-os/core.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/core.nix b/nix-os/core.nix index 41a4cc7..2e8e21e 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -20,6 +20,7 @@ let paths = [ pkgs.nix ] ++ wrappedNixExecutables false; }).overrideAttrs { version = pkgs.nix.version; + passthru.meta = pkgs.nix.meta; }; in { From fe2aec66814827a2b95d12ce26b5a2deb7917fe4 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 18 Oct 2024 14:24:22 +0200 Subject: [PATCH 081/218] lock: update --- lock.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lock.nix b/lock.nix index 598d67e..0ed1876 100644 --- a/lock.nix +++ b/lock.nix @@ -4,11 +4,11 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "1bfbbbe5bbf888d675397c66bfdb275d0b99361c"; - sha256 = "0yh9yljqlsaqdrngqksgabh4jsmjl35x3k1dwfvw4p76ahrv8ikb"; + revision = "dc2e0028d274394f73653c7c90cc63edbb696be1"; + sha256 = "0wvzsbrm5z0h8akm4i24lh3x02bh6srkg4zw2z5pfj9yyss678hq"; }; cosmic-modules = { - revision = "a8960f9c66a0c4f2c24ae029da0886df4a68af33"; - sha256 = "0l6y68pkrvh4iv2b5nj8drnlyxyvv0zkvk6r9zq3alfvmzwbqp2q"; + revision = "e1c81bcb1321916bc1546d3da4907f31c5a5e948"; + sha256 = "11jp6brb756i08zgmp0wh25fx7pd1czn678yfy2r2lbknby1dpa0"; }; } From da09435c32f6f28005c6ca54c5da47eb370e85b3 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 27 Oct 2024 19:55:59 +0100 Subject: [PATCH 082/218] lock: update --- lock.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lock.nix b/lock.nix index 0ed1876..e2bb185 100644 --- a/lock.nix +++ b/lock.nix @@ -4,11 +4,11 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "dc2e0028d274394f73653c7c90cc63edbb696be1"; - sha256 = "0wvzsbrm5z0h8akm4i24lh3x02bh6srkg4zw2z5pfj9yyss678hq"; + revision = "cd3e8833d70618c4eea8df06f95b364b016d4950"; + sha256 = "1fg5pl26c7n82wgjkxs7x34qwzdyyh0lld8nhd89j2fkcw2daycj"; }; cosmic-modules = { - revision = "e1c81bcb1321916bc1546d3da4907f31c5a5e948"; - sha256 = "11jp6brb756i08zgmp0wh25fx7pd1czn678yfy2r2lbknby1dpa0"; + revision = "5ec4c2f99d7ac9c51b209989492657d426a9fdcc"; + sha256 = "1bxx0i290w9ph8745lqxrivg5b5j6ykgs7mlxaapcx2kqxd0ndfj"; }; } From c9c80b8941b81827bb2da52f09a674e003fdc354 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 27 Oct 2024 20:05:03 +0100 Subject: [PATCH 083/218] nixos/core: enable verbose commit for git --- nix-os/core.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/core.nix b/nix-os/core.nix index 2e8e21e..538835d 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -62,6 +62,7 @@ in programs.git.enable = true; programs.git.config = { + commit.verbose = true; init.defaultBranch = "main"; merge.conflictstyle = "diff3"; rerere.enabled = true; From d9a2100e69b45852da494560183f204149a18044 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 30 Oct 2024 14:10:40 +0100 Subject: [PATCH 084/218] nixos/cosmic: add screenshot keybind --- .../com.system76.CosmicSettings.Shortcuts/v1/custom | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicSettings.Shortcuts/v1/custom b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicSettings.Shortcuts/v1/custom index 6c6d1b7..cf90d84 100644 --- a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicSettings.Shortcuts/v1/custom +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicSettings.Shortcuts/v1/custom @@ -7,6 +7,13 @@ key: "t", description: Some("Open terminal"), ): Spawn("kitty"), + ( + modifiers: [ + Super, + Shift, + ], + key: "s", + ): System(Screenshot), ( modifiers: [ Super, From 16c1dd9c791e4c50176a57f34dd36620150bc42a Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 3 Nov 2024 16:21:38 +0100 Subject: [PATCH 085/218] nixos/generic/mpv: init --- nix-os/generic/mpv.nix | 90 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 nix-os/generic/mpv.nix diff --git a/nix-os/generic/mpv.nix b/nix-os/generic/mpv.nix new file mode 100644 index 0000000..58eddef --- /dev/null +++ b/nix-os/generic/mpv.nix @@ -0,0 +1,90 @@ +{config, lib, options, pkgs, ... }: + +let + cfg = config.programs.mpv; + opts = options.programs.mpv; + + toMpvIniString = attrset: lib.pipe attrset [ + (lib.mapAttrsToList (name: value: "${name}=${value}")) + (lib.concatStringsSep "\n") + ]; + + configDir = pkgs.symlinkJoin { + name = "mpv-config-dir"; + paths = lib.optional opts.settings.mpv.isDefined (pkgs.writeTextFile { + name = "mpv-config-dir-mpv.conf"; + destination = "/share/mpv/mpv.conf"; + text = toMpvIniString cfg.settings.mpv; + }) ++ lib.optional opts.settings.input.isDefined (pkgs.writeTextFile { + name = "mpv-config-dir-input.conf"; + destination = "/share/mpv/input.conf"; + text = cfg.settings.input; + }) ++ lib.mapAttrsToList (filename: opts: pkgs.writeTextFile { + name = "mpv-config-dir-script-opts-${filename}"; + destination = "/share/mpv/script-opts/${filename}"; + text = toMpvIniString opts; + }) cfg.settings.script-opts; + }; + + wrappedMpv = pkgs.wrapMpv cfg.package { + youtubeSupport = cfg.youtubeSupport; + scripts = cfg.scripts; + extraMakeWrapperArgs = lib.optionals (lib.any (x: x) [ + opts.settings.mpv.isDefined + opts.settings.input.isDefined + (lib.length (lib.attrNames cfg.settings.script-opts) > 0) + ]) [ + "--add-flags" "--config-dir='${configDir}/share/mpv'" + ]; + }; +in +{ + options.programs.mpv = { + enable = lib.mkEnableOption "mpv"; + package = lib.mkPackageOption pkgs "mpv-unwrapped" {}; + scripts = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = []; + }; + youtubeSupport = lib.mkEnableOption "yt-dlp support for mpv" // { + default = true; + }; + settings = let + mpvini = lib.types.attrsOf lib.types.str; + in { + script-opts = lib.mkOption { + type = lib.types.attrsOf mpvini; + default = {}; + example = { + "crop.conf".draw_crosshair = "yes"; + }; + description = '' + A map of script options for mpv scripts. + The key is the filename of the script, and the value is a map of options. + ''; + }; + input = lib.mkOption { + type = lib.types.separatedString "\n"; + example = '' + Alt+1 set window-scale 0.125 + ''; + description = '' + A list of input commands to be added to the input.conf file. + ''; + }; + mpv = lib.mkOption { + type = mpvini; + example = { + keep-open = "yes"; + osd-fractions = "yes"; + }; + description = '' + A map of mpv options. + ''; + }; + }; + }; + config = lib.mkIf cfg.enable { + environment.systemPackages = [ wrappedMpv ]; + }; +} From 4f57f67555e22fa77a7166762fa081130e32b69f Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 3 Nov 2024 16:27:36 +0100 Subject: [PATCH 086/218] nixos/core-desktop: declaratively configure mpv --- nix-os/core-desktop.nix | 74 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix index 3158287..617b79a 100644 --- a/nix-os/core-desktop.nix +++ b/nix-os/core-desktop.nix @@ -1,6 +1,9 @@ {config, lib, pkgs, ... }: { + imports = [ + ./generic/mpv.nix + ]; config = { services.printing.enable = true; @@ -19,10 +22,79 @@ environment.systemPackages = with pkgs; [ kdePackages.kdeconnect-kde - mpv pcmanfm ]; + programs.mpv = let + fetchMpvScript = {url, hash, scriptName}: pkgs.fetchurl { + inherit url hash; + name = "mpv-script-${scriptName}"; + recursiveHash = true; + downloadToTemp = true; + postFetch = '' + mkdir -p $out/share/mpv/scripts + mv $downloadedFile $out/share/mpv/scripts/${scriptName} + ''; + passthru.scriptName = scriptName; + }; + in { + enable = true; + scripts = [ + pkgs.mpvScripts.sponsorblock + pkgs.mpvScripts.mpris + ] ++ lib.map (script: fetchMpvScript { + url = "https://raw.githubusercontent.com/occivink/mpv-scripts/d0390c8e802c2e888ff4a2e1d5e4fb040f855b89/scripts/${script.name}"; + hash = script.hash; + scriptName = script.name; + }) [ + { name = "crop.lua"; hash = "sha256-/uaTCtV8Aanvnxrt8afBbO4uu2xp8Ec6DxApMb+fg2s="; } + { name = "encode.lua"; hash = "sha256-yK/DV0cpGhl4Uobl7xA1myZiECJpsShrHnsJftBqzAY="; } + ]; + settings = { + mpv = { + keep-open = "yes"; + volume = "40"; + osd-fractions = "yes"; + background = "0.0/1.0"; + alpha = "yes"; + }; + input = lib.mkMerge [ + # mpv core + '' + Alt+1 set window-scale 0.125 + Alt+2 set window-scale 0.25 + Alt+3 set window-scale 0.5 + Alt+4 set window-scale 1 + Alt+5 set window-scale 2 + '' + # crop.lua + '' + c script-message-to crop start-crop hard + alt+c script-message-to crop start-crop soft + ctrl+shift+c script-message-to crop start-crop delogo + C script-message-to crop toggle-crop hard + '' + # encode.lua + '' + b script-message-to encode encode_default + alt+b script-message-to encode set-timestamp encode_default + '' + ]; + script-opts = { + "encode_default.conf" = { + only_active_tracks = "no"; + preserve_filters = "yes"; + append_filder = ""; + codec = ""; + output_format = "$f_$n.$x"; + output_dir = "/tmp"; + detached = "no"; + ffmpeg_command = lib.getExe pkgs.ffmpeg; + }; + }; + }; + }; + services.openssh.extraConfig = '' X11Forwarding yes ''; From d33030472f0a62cc040b7357da98f7f940a12173 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 3 Nov 2024 17:13:16 +0100 Subject: [PATCH 087/218] nixos/generic/mpv: fix format --- nix-os/generic/mpv.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nix-os/generic/mpv.nix b/nix-os/generic/mpv.nix index 58eddef..83d4390 100644 --- a/nix-os/generic/mpv.nix +++ b/nix-os/generic/mpv.nix @@ -5,9 +5,9 @@ let opts = options.programs.mpv; toMpvIniString = attrset: lib.pipe attrset [ - (lib.mapAttrsToList (name: value: "${name}=${value}")) - (lib.concatStringsSep "\n") - ]; + (lib.mapAttrsToList (name: value: "${name}=${value}")) + (lib.concatStringsSep "\n") + ]; configDir = pkgs.symlinkJoin { name = "mpv-config-dir"; From 1091dea58e60c8ec4c3a1e40a8300aed4312e7c8 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 4 Nov 2024 00:06:39 +0100 Subject: [PATCH 088/218] nixos/nvidia: update nvidia drivers to 565.57.01 --- nix-os/nvidia.nix | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/nix-os/nvidia.nix b/nix-os/nvidia.nix index 90c881f..98e1e1f 100644 --- a/nix-os/nvidia.nix +++ b/nix-os/nvidia.nix @@ -16,13 +16,21 @@ powerManagement.enable = true; open = false; nvidiaSettings = true; - package = config.boot.kernelPackages.nvidiaPackages.mkDriver { - version = "555.58.02"; - sha256_64bit = "sha256-xctt4TPRlOJ6r5S54h5W6PT6/3Zy2R4ASNFPu8TSHKM="; - sha256_aarch64 = "sha256-wb20isMrRg8PeQBU96lWJzBMkjfySAUaqt4EgZnhyF8="; - openSha256 = "sha256-8hyRiGB+m2hL3c9MDA/Pon+Xl6E788MZ50WrrAGUVuY="; - settingsSha256 = "sha256-ZpuVZybW6CFN/gz9rx+UJvQ715FZnAOYfHn5jt5Z2C8="; - persistencedSha256 = "sha256-a1D7ZZmcKFWfPjjH1REqPM5j/YLWKnbkP9qfRyIyxAw="; + package = let + nvidiaDrivers = config.boot.kernelPackages.nvidiaPackages.mkDriver { + version = "565.57.01"; + sha256_64bit = "sha256-buvpTlheOF6IBPWnQVLfQUiHv4GcwhvZW3Ks0PsYLHo="; + sha256_aarch64 = "sha256-aDVc3sNTG4O3y+vKW87mw+i9AqXCY29GVqEIUlsvYfE="; + openSha256 = "sha256-/tM3n9huz1MTE6KKtTCBglBMBGGL/GOHi5ZSUag4zXA="; + settingsSha256 = "sha256-H7uEe34LdmUFcMcS6bz7sbpYhg9zPCb/5AmZZFTx1QA="; + persistencedSha256 = "sha256-hdszsACWNqkCh8G4VBNitDT85gk9gJe1BlQ8LdrYIkg="; + }; + # TODO: Remove after updating nixpkgs to 24.11 + # https://github.com/NixOS/nixpkgs/commit/0384602eac8bc57add3227688ec242667df3ffe3 + in nvidiaDrivers // { + settings = nvidiaDrivers.settings.overrideAttrs (oldAttrs: { + buildInputs = oldAttrs.buildInputs ++ [ pkgs.vulkan-headers ]; + }); }; }; nixpkgs.config.nvidia.acceptLicense = true; From 209c87b0ee637b744a6ac217058844ad5f8a5643 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 5 Nov 2024 08:18:44 +0100 Subject: [PATCH 089/218] lock: update --- lock.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lock.nix b/lock.nix index e2bb185..9497803 100644 --- a/lock.nix +++ b/lock.nix @@ -4,11 +4,11 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "cd3e8833d70618c4eea8df06f95b364b016d4950"; - sha256 = "1fg5pl26c7n82wgjkxs7x34qwzdyyh0lld8nhd89j2fkcw2daycj"; + revision = "d063c1dd113c91ab27959ba540c0d9753409edf3"; + sha256 = "0nh2q19pcw3nccdsr3318zsbsdanfs6ckapi4wrnm4bxdmcbrnbr"; }; cosmic-modules = { - revision = "5ec4c2f99d7ac9c51b209989492657d426a9fdcc"; - sha256 = "1bxx0i290w9ph8745lqxrivg5b5j6ykgs7mlxaapcx2kqxd0ndfj"; + revision = "c62f5e8c7a9a1ebc4013b617e0e054011c747d49"; + sha256 = "04w4i463rky5fl17gsgfym6lj9ccfrywp4cdwi4sd801vamgzcd8"; }; } From fc7790bc158473ae8cf6f9b13ece5d7e7c6b8ede Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 7 Nov 2024 19:35:52 +0100 Subject: [PATCH 090/218] hosts/main: enable i2c and openrgb for rgb control --- hosts/main/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hosts/main/default.nix b/hosts/main/default.nix index 4da73cf..9514030 100644 --- a/hosts/main/default.nix +++ b/hosts/main/default.nix @@ -71,6 +71,10 @@ services.printing.startWhenNeeded = false; + # rgb control for razer, graphics card and motherboard + hardware.i2c.enable = true; + services.hardware.openrgb.enable = true; + system.stateVersion = "23.05"; }; } From 7f1e5ea8ab473d7dea885152859f32bd292917d1 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 20 Nov 2024 19:18:22 +0100 Subject: [PATCH 091/218] lock: update --- lock.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lock.nix b/lock.nix index 9497803..ff58f5c 100644 --- a/lock.nix +++ b/lock.nix @@ -4,11 +4,11 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "d063c1dd113c91ab27959ba540c0d9753409edf3"; - sha256 = "0nh2q19pcw3nccdsr3318zsbsdanfs6ckapi4wrnm4bxdmcbrnbr"; + revision = "e8c38b73aeb218e27163376a2d617e61a2ad9b59"; + sha256 = "1n6gdjny8k5rwkxh6sp1iwg1y3ni1pm7lvh9sisifgjb18jdvzbm"; }; cosmic-modules = { - revision = "c62f5e8c7a9a1ebc4013b617e0e054011c747d49"; - sha256 = "04w4i463rky5fl17gsgfym6lj9ccfrywp4cdwi4sd801vamgzcd8"; + revision = "7dc8180bce46f1ed1446371369faf237e3a3eb15"; + sha256 = "13v4k0qx1c9j2fgz05prvq81s73v4gjk113dchl9pci0xcy3n698"; }; } From bb10e0e0c4ffe9d2aa765524e0b98a1d327b3131 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 22 Nov 2024 22:31:14 +0100 Subject: [PATCH 092/218] nixos/xdg-default-apps: set pdf to vivaldi browser --- nix-os/xdg-default-apps.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/xdg-default-apps.nix b/nix-os/xdg-default-apps.nix index 2211375..7412f27 100644 --- a/nix-os/xdg-default-apps.nix +++ b/nix-os/xdg-default-apps.nix @@ -8,6 +8,7 @@ "application/xhtml+xml" = "vivaldi-stable.desktop"; "text/html" = "vivaldi-stable.desktop"; "x-scheme-handler/https" = "vivaldi-stable.desktop"; + "application/pdf" = "vivaldi-stable.desktop"; # Audio "audio/aiff" = "mpv.desktop"; From 82880c0e2f18fbe3afacd3da3a0a378f49deb2f4 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 23 Nov 2024 19:52:48 +0100 Subject: [PATCH 093/218] nixos/{core-desktop; xdg-default-apps}: add qimgv and set as default for images --- nix-os/core-desktop.nix | 1 + nix-os/xdg-default-apps.nix | 92 ++++++++++++++++++------------------- 2 files changed, 47 insertions(+), 46 deletions(-) diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix index 617b79a..1089f0a 100644 --- a/nix-os/core-desktop.nix +++ b/nix-os/core-desktop.nix @@ -23,6 +23,7 @@ environment.systemPackages = with pkgs; [ kdePackages.kdeconnect-kde pcmanfm + qimgv ]; programs.mpv = let diff --git a/nix-os/xdg-default-apps.nix b/nix-os/xdg-default-apps.nix index 7412f27..5033d02 100644 --- a/nix-os/xdg-default-apps.nix +++ b/nix-os/xdg-default-apps.nix @@ -87,51 +87,51 @@ "video/x-sgi-movie" = "mpv.desktop"; # Image - "image/bmp" = "org.gnome.Loupe.desktop"; - "image/cmu-raster" = "org.gnome.Loupe.desktop"; - "image/fif" = "org.gnome.Loupe.desktop"; - "image/florian" = "org.gnome.Loupe.desktop"; - "image/g3fax" = "org.gnome.Loupe.desktop"; - "image/gif" = "org.gnome.Loupe.desktop"; - "image/ief" = "org.gnome.Loupe.desktop"; - "image/jpeg" = "org.gnome.Loupe.desktop"; - "image/jutvision" = "org.gnome.Loupe.desktop"; - "image/naplps" = "org.gnome.Loupe.desktop"; - "image/pict" = "org.gnome.Loupe.desktop"; - "image/pjpeg" = "org.gnome.Loupe.desktop"; - "image/png" = "org.gnome.Loupe.desktop"; - "image/tiff" = "org.gnome.Loupe.desktop"; - "image/vasa" = "org.gnome.Loupe.desktop"; - "image/vnd.dwg" = "org.gnome.Loupe.desktop"; - "image/vnd.fpx" = "org.gnome.Loupe.desktop"; - "image/vnd.net-fpx" = "org.gnome.Loupe.desktop"; - "image/vnd.rn-realflash" = "org.gnome.Loupe.desktop"; - "image/vnd.rn-realpix" = "org.gnome.Loupe.desktop"; - "image/vnd.wap.wbmp" = "org.gnome.Loupe.desktop"; - "image/vnd.xiff" = "org.gnome.Loupe.desktop"; - "image/x-cmu-raster" = "org.gnome.Loupe.desktop"; - "image/x-dwg" = "org.gnome.Loupe.desktop"; - "image/x-icon" = "org.gnome.Loupe.desktop"; - "image/x-jg" = "org.gnome.Loupe.desktop"; - "image/x-jps" = "org.gnome.Loupe.desktop"; - "image/x-niff" = "org.gnome.Loupe.desktop"; - "image/x-pcx" = "org.gnome.Loupe.desktop"; - "image/x-pict" = "org.gnome.Loupe.desktop"; - "image/x-portable-anymap" = "org.gnome.Loupe.desktop"; - "image/x-portable-bitmap" = "org.gnome.Loupe.desktop"; - "image/x-portable-graymap" = "org.gnome.Loupe.desktop"; - "image/x-portable-greymap" = "org.gnome.Loupe.desktop"; - "image/x-portable-pixmap" = "org.gnome.Loupe.desktop"; - "image/x-quicktime" = "org.gnome.Loupe.desktop"; - "image/x-rgb" = "org.gnome.Loupe.desktop"; - "image/x-tiff" = "org.gnome.Loupe.desktop"; - "image/x-windows-bmp" = "org.gnome.Loupe.desktop"; - "image/x-xbitmap" = "org.gnome.Loupe.desktop"; - "image/x-xbm" = "org.gnome.Loupe.desktop"; - "image/x-xpixmap" = "org.gnome.Loupe.desktop"; - "image/x-xwd" = "org.gnome.Loupe.desktop"; - "image/x-xwindowdump" = "org.gnome.Loupe.desktop"; - "image/xbm" = "org.gnome.Loupe.desktop"; - "image/xpm" = "org.gnome.Loupe.desktop"; + "image/bmp" = "qimgv.desktop"; + "image/cmu-raster" = "qimgv.desktop"; + "image/fif" = "qimgv.desktop"; + "image/florian" = "qimgv.desktop"; + "image/g3fax" = "qimgv.desktop"; + "image/gif" = "qimgv.desktop"; + "image/ief" = "qimgv.desktop"; + "image/jpeg" = "qimgv.desktop"; + "image/jutvision" = "qimgv.desktop"; + "image/naplps" = "qimgv.desktop"; + "image/pict" = "qimgv.desktop"; + "image/pjpeg" = "qimgv.desktop"; + "image/png" = "qimgv.desktop"; + "image/tiff" = "qimgv.desktop"; + "image/vasa" = "qimgv.desktop"; + "image/vnd.dwg" = "qimgv.desktop"; + "image/vnd.fpx" = "qimgv.desktop"; + "image/vnd.net-fpx" = "qimgv.desktop"; + "image/vnd.rn-realflash" = "qimgv.desktop"; + "image/vnd.rn-realpix" = "qimgv.desktop"; + "image/vnd.wap.wbmp" = "qimgv.desktop"; + "image/vnd.xiff" = "qimgv.desktop"; + "image/x-cmu-raster" = "qimgv.desktop"; + "image/x-dwg" = "qimgv.desktop"; + "image/x-icon" = "qimgv.desktop"; + "image/x-jg" = "qimgv.desktop"; + "image/x-jps" = "qimgv.desktop"; + "image/x-niff" = "qimgv.desktop"; + "image/x-pcx" = "qimgv.desktop"; + "image/x-pict" = "qimgv.desktop"; + "image/x-portable-anymap" = "qimgv.desktop"; + "image/x-portable-bitmap" = "qimgv.desktop"; + "image/x-portable-graymap" = "qimgv.desktop"; + "image/x-portable-greymap" = "qimgv.desktop"; + "image/x-portable-pixmap" = "qimgv.desktop"; + "image/x-quicktime" = "qimgv.desktop"; + "image/x-rgb" = "qimgv.desktop"; + "image/x-tiff" = "qimgv.desktop"; + "image/x-windows-bmp" = "qimgv.desktop"; + "image/x-xbitmap" = "qimgv.desktop"; + "image/x-xbm" = "qimgv.desktop"; + "image/x-xpixmap" = "qimgv.desktop"; + "image/x-xwd" = "qimgv.desktop"; + "image/x-xwindowdump" = "qimgv.desktop"; + "image/xbm" = "qimgv.desktop"; + "image/xpm" = "qimgv.desktop"; }; } From b8d79d3515351d83d3a3970c84f4d8e3ca187091 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 28 Nov 2024 22:02:51 +0100 Subject: [PATCH 094/218] nixos/core-desktop: import xdg-default-apps module --- hosts/main/default.nix | 1 - hosts/vm-base.nix | 1 - nix-os/core-desktop.nix | 1 + 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/hosts/main/default.nix b/hosts/main/default.nix index 9514030..9d3966f 100644 --- a/hosts/main/default.nix +++ b/hosts/main/default.nix @@ -20,7 +20,6 @@ ../../nix-os/locale.nix ../../nix-os/adb.nix ../../nix-os/account.nix - ../../nix-os/xdg-default-apps.nix ../../nix-os/services/nix-binary-cache.nix ../../nix-os/udev.nix ../../nix-os/gnupg.nix diff --git a/hosts/vm-base.nix b/hosts/vm-base.nix index 3aac310..9c7a57a 100644 --- a/hosts/vm-base.nix +++ b/hosts/vm-base.nix @@ -10,7 +10,6 @@ ../nix-os/polkit/disable-shutdown.nix ../nix-os/shell.nix ../nix-os/udev.nix - ../nix-os/xdg-default-apps.nix ]; config = { diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix index 1089f0a..6809bbe 100644 --- a/nix-os/core-desktop.nix +++ b/nix-os/core-desktop.nix @@ -3,6 +3,7 @@ { imports = [ ./generic/mpv.nix + ./xdg-default-apps.nix ]; config = { services.printing.enable = true; From 5f531791f770eac993eade181df809f6ceef2f5b Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 30 Nov 2024 20:34:58 +0100 Subject: [PATCH 095/218] nixos/module-overrides: init, override luksroot --- nix-os/core.nix | 4 ++++ nix-os/module-overrides.nix | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 nix-os/module-overrides.nix diff --git a/nix-os/core.nix b/nix-os/core.nix index 538835d..1b4bb40 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -24,6 +24,10 @@ let }; in { + imports = [ + ./module-overrides.nix + ]; + # kernel boot.kernelPackages = pkgs.linuxPackages_latest; diff --git a/nix-os/module-overrides.nix b/nix-os/module-overrides.nix new file mode 100644 index 0000000..6b5f76e --- /dev/null +++ b/nix-os/module-overrides.nix @@ -0,0 +1,27 @@ +{ lib, ... }: +let + moduleOverrides = [ + # TODO: Remove after updating to nixos 25.05 + { + # https://github.com/NixOS/nixpkgs/pull/359882 + disabledModules = [ + "system/boot/luksroot.nix" + ]; + replacementModules = [(builtins.fetchurl { + url = "https://raw.githubusercontent.com/amozeo/nixpkgs/728d5806fe6f975ba3843297332d12e13119fe86/nixos/modules/system/boot/luksroot.nix"; + sha256 = "0s2k8k6rrlwn2zb02q6fkvswln8w4hvh02hm4krqvkh46amyasyy"; + })]; + } + ]; + + toModule = entry: { + imports = entry.replacementModules; + disabledModules = entry.disabledModules; + _file = let + info = builtins.unsafeGetAttrPos "disabledModules" entry; + in "${info.file}:L${info.line}"; + }; +in +{ + imports = lib.map toModule moduleOverrides; +} From 6f479945b7a59db4ea730556c9323c6855e25530 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 2 Dec 2024 01:59:38 +0100 Subject: [PATCH 096/218] lock: update and switch nixpkgs to nixos-24.11 --- lock.nix | 4 +- nix-os/core-desktop.nix | 1 - nix-os/generic/mpv.nix | 3 +- nix-os/nvidia.nix | 27 +- pkgs/by-name/ni/nixos-rebuild/_nixos-rebuild | 165 ---- pkgs/by-name/ni/nixos-rebuild/nixos-rebuild.8 | 558 ----------- .../by-name/ni/nixos-rebuild/nixos-rebuild.sh | 874 ------------------ pkgs/by-name/ni/nixos-rebuild/package.nix | 59 -- pkgs/by-name/ni/nixos-rebuild/test/repl.nix | 159 ---- pkgs/overlays/selfExpr.nix | 5 +- 10 files changed, 17 insertions(+), 1838 deletions(-) delete mode 100644 pkgs/by-name/ni/nixos-rebuild/_nixos-rebuild delete mode 100644 pkgs/by-name/ni/nixos-rebuild/nixos-rebuild.8 delete mode 100755 pkgs/by-name/ni/nixos-rebuild/nixos-rebuild.sh delete mode 100644 pkgs/by-name/ni/nixos-rebuild/package.nix delete mode 100644 pkgs/by-name/ni/nixos-rebuild/test/repl.nix diff --git a/lock.nix b/lock.nix index ff58f5c..81ac456 100644 --- a/lock.nix +++ b/lock.nix @@ -4,8 +4,8 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "e8c38b73aeb218e27163376a2d617e61a2ad9b59"; - sha256 = "1n6gdjny8k5rwkxh6sp1iwg1y3ni1pm7lvh9sisifgjb18jdvzbm"; + revision = "62c435d93bf046a5396f3016472e8f7c8e2aed65"; + sha256 = "0zpvadqbs19jblnd0j2rfs9m7j0n5spx0vilq8907g2gqrx63fqp"; }; cosmic-modules = { revision = "7dc8180bce46f1ed1446371369faf237e3a3eb15"; diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix index 6809bbe..fe44a32 100644 --- a/nix-os/core-desktop.nix +++ b/nix-os/core-desktop.nix @@ -8,7 +8,6 @@ config = { services.printing.enable = true; - sound.enable = false; hardware.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = { diff --git a/nix-os/generic/mpv.nix b/nix-os/generic/mpv.nix index 83d4390..c2c780c 100644 --- a/nix-os/generic/mpv.nix +++ b/nix-os/generic/mpv.nix @@ -26,7 +26,8 @@ let }) cfg.settings.script-opts; }; - wrappedMpv = pkgs.wrapMpv cfg.package { + wrappedMpv = cfg.package.wrapper { + mpv = cfg.package; youtubeSupport = cfg.youtubeSupport; scripts = cfg.scripts; extraMakeWrapperArgs = lib.optionals (lib.any (x: x) [ diff --git a/nix-os/nvidia.nix b/nix-os/nvidia.nix index 98e1e1f..7fe36eb 100644 --- a/nix-os/nvidia.nix +++ b/nix-os/nvidia.nix @@ -1,10 +1,9 @@ { config, lib, pkgs, ...}: { - hardware.opengl = { + hardware.graphics = { enable = true; - driSupport = true; - driSupport32Bit = true; + enable32Bit = true; }; # Workaround for nvidia driver ghost display @@ -16,21 +15,13 @@ powerManagement.enable = true; open = false; nvidiaSettings = true; - package = let - nvidiaDrivers = config.boot.kernelPackages.nvidiaPackages.mkDriver { - version = "565.57.01"; - sha256_64bit = "sha256-buvpTlheOF6IBPWnQVLfQUiHv4GcwhvZW3Ks0PsYLHo="; - sha256_aarch64 = "sha256-aDVc3sNTG4O3y+vKW87mw+i9AqXCY29GVqEIUlsvYfE="; - openSha256 = "sha256-/tM3n9huz1MTE6KKtTCBglBMBGGL/GOHi5ZSUag4zXA="; - settingsSha256 = "sha256-H7uEe34LdmUFcMcS6bz7sbpYhg9zPCb/5AmZZFTx1QA="; - persistencedSha256 = "sha256-hdszsACWNqkCh8G4VBNitDT85gk9gJe1BlQ8LdrYIkg="; - }; - # TODO: Remove after updating nixpkgs to 24.11 - # https://github.com/NixOS/nixpkgs/commit/0384602eac8bc57add3227688ec242667df3ffe3 - in nvidiaDrivers // { - settings = nvidiaDrivers.settings.overrideAttrs (oldAttrs: { - buildInputs = oldAttrs.buildInputs ++ [ pkgs.vulkan-headers ]; - }); + package = config.boot.kernelPackages.nvidiaPackages.mkDriver { + version = "565.57.01"; + sha256_64bit = "sha256-buvpTlheOF6IBPWnQVLfQUiHv4GcwhvZW3Ks0PsYLHo="; + sha256_aarch64 = "sha256-aDVc3sNTG4O3y+vKW87mw+i9AqXCY29GVqEIUlsvYfE="; + openSha256 = "sha256-/tM3n9huz1MTE6KKtTCBglBMBGGL/GOHi5ZSUag4zXA="; + settingsSha256 = "sha256-H7uEe34LdmUFcMcS6bz7sbpYhg9zPCb/5AmZZFTx1QA="; + persistencedSha256 = "sha256-hdszsACWNqkCh8G4VBNitDT85gk9gJe1BlQ8LdrYIkg="; }; }; nixpkgs.config.nvidia.acceptLicense = true; diff --git a/pkgs/by-name/ni/nixos-rebuild/_nixos-rebuild b/pkgs/by-name/ni/nixos-rebuild/_nixos-rebuild deleted file mode 100644 index 84e8d22..0000000 --- a/pkgs/by-name/ni/nixos-rebuild/_nixos-rebuild +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/env bash - -# We're faking a `nix build` command-line to re-use Nix's own completion -# for the few options passed through to Nix. -_nixos-rebuild_pretend-nix() { - COMP_LINE="nix build ${COMP_LINE}" - # number of prepended chars - (( COMP_POINT = COMP_POINT + 10)) - - COMP_WORDS=( - nix build - "${COMP_WORDS[@]}" - ) - # Add the amount of prepended words - (( COMP_CWORD = COMP_CWORD + 2)) - _complete_nix "nix" -} - -_nixos-rebuild() { - local curr="$2" - local prev="$3" - local subcommandGiven=0 - local word - local subcommand - - __load_completion nix - - # Arrays are re-ordered by the completion, so it's fine to sort them in logical chunks - local all_args=( - --verbose -v - - # nixos-rebuild options - --fast - --no-build-nix - --profile-name -p # name - --rollback - --specialisation -c # name - --use-remote-sudo - --build-host # host - --target-host # host - # Used with list-generations - --json - - # generation switching options - --install-bootloader - - # nix-channel options - --upgrade - --upgrade-all - - # flakes options - --commit-lock-file - --flake # flake-uri - --override-input # input-name flake-uri - --recreate-lock-file - --update-input - --no-flake - --no-registries - --no-update-lock-file - --no-write-lock-file - - # Nix-copy options - --use-substitutes --substitute-on-destination -s - - # Nix options - --option - --impure - --builders # builder-spec - --show-trace - --keep-failed -K - --keep-going -k - --max-jobs -j # number - --log-format # format - -I # NIX_PATH - ) - - local all_subcommands=( - boot - build - build-vm - build-vm-with-bootloader - dry-activate - dry-build - edit - list-generations - switch - test - ) - - # Suggest arguments that can be consumed under some conditions only - for word in "${COMP_WORDS[@]}"; do - for subcommand in "${all_subcommands[@]}"; do - if [[ "$word" == "$subcommand" ]]; then - subcommandGiven=1 - fi - done - done - - # Fake out a way to complete the second arg to some options - case "${COMP_WORDS[COMP_CWORD-2]}" in - "--override-input") - prev="--override-input_2" - ;; - "--option") - prev="--option_2" - ;; - esac - - case "$prev" in - --max-jobs|-j) - COMPREPLY=( ) - ;; - - --profile-name|-p) - if [[ "$curr" == "" ]]; then - COMPREPLY=( /nix/var/nix/profiles/* ) - else - COMPREPLY=( "$curr"* ) - fi - ;; - - --build-host|--target-host|-t|-h) - _known_hosts_real "$curr" - ;; - - --specialisation|-c) - COMPREPLY=() - ;; - - -I) - _nixos-rebuild_pretend-nix - ;; - --builders) - _nixos-rebuild_pretend-nix - ;; - --flake) - _nixos-rebuild_pretend-nix - ;; - --override-input) - _nixos-rebuild_pretend-nix - ;; - --override-input_2) - _nixos-rebuild_pretend-nix - ;; - --log-format) - _nixos-rebuild_pretend-nix - ;; - --option) - _nixos-rebuild_pretend-nix - ;; - --option_2) - _nixos-rebuild_pretend-nix - ;; - - *) - if [[ "$curr" == -* ]] || (( subcommandGiven )); then - COMPREPLY=( $(compgen -W "${all_args[*]}" -- "$2") ) - else - COMPREPLY=( $(compgen -W "${all_subcommands[*]}" -- "$2") ) - fi - ;; - esac -} - -complete -F _nixos-rebuild nixos-rebuild diff --git a/pkgs/by-name/ni/nixos-rebuild/nixos-rebuild.8 b/pkgs/by-name/ni/nixos-rebuild/nixos-rebuild.8 deleted file mode 100644 index 1704993..0000000 --- a/pkgs/by-name/ni/nixos-rebuild/nixos-rebuild.8 +++ /dev/null @@ -1,558 +0,0 @@ -.Dd January 1, 1980 -.Dt nixos-rebuild 8 -.Os -.Sh NAME -.Nm nixos-rebuild -.Nd reconfigure a NixOS machine -. -. -. -.Sh SYNOPSIS -.Nm -.Bro -.Cm switch | boot | test | build | dry-build | dry-activate | edit | repl | build-vm | build-vm-with-bootloader | list-generations Op Fl -json -.Brc -.br -.Op Fl -upgrade | -upgrade-all -.Op Fl -install-bootloader -.Op Fl -no-build-nix -.Op Fl -fast -.Op Fl -rollback -.br -.Op Fl -file | F Ar path -.Op Fl -attr | A Ar attrPath -.Op Fl -flake Ar flake-uri -.Op Fl -no-flake -.Op Fl -recreate-lock-file -.Op Fl -no-update-lock-file -.Op Fl -no-write-lock-file -.Op Fl -no-registries -.Op Fl -commit-lock-file -.Op Fl -update-input Ar input-path -.Op Fl -override-input Ar input-path flake-url -.br -.Op Fl -profile-name | p Ar name -.Op Fl -specialisation | c Ar name -.br -.Op Fl -build-host Va host -.Op Fl -target-host Va host -.Op Fl -use-remote-sudo -.br -.Op Fl -verbose | v -.Op Fl -quiet -.Op Fl -log-format Ar format -.Op Fl -no-build-output | Q -.Op Fl -max-jobs | j Va number -.Op Fl -cores Va number -.Op Fl -keep-going | k -.Op Fl -keep-failed | K -.Op Fl -fallback -.Op Fl I Va NIX_PATH -.Op Fl -option Ar name value -.Op Fl -repair -.Op Fl -builders Va builder-spec -.Op Fl -accept-flake-config -.Op Fl -print-build-logs | L -.Op Fl -show-trace -.Op Fl -refresh -.Op Fl -impure -.Op Fl -offline -.Op Fl -no-net -. -. -. -.Sh DESCRIPTION -This command updates the system so that it corresponds to the -configuration specified in -.Pa /etc/nixos/configuration.nix Ns -, -.Pa /etc/nixos/flake.nix -or the file and attribute specified by the -.Fl -file -and/or -.Fl -attr -options. Thus, every time you modify the configuration or any other NixOS -module, you must run -.Nm -to make the changes take effect. It builds the new system in -.Pa /nix/store Ns -, runs its activation script, and stop and (re)starts any system services if -needed. Please note that user services need to be started manually as they -aren't detected by the activation script at the moment. -. -.Pp -This command has one required argument, which specifies the desired -operation. It must be one of the following: -.Bl -tag -width indent -.It Cm switch -Build and activate the new configuration, and make it the boot default. That -is, the configuration is added to the GRUB boot menu as the default -menu entry, so that subsequent reboots will boot the system into the new -configuration. Previous configurations activated with -.Ic nixos-rebuild switch -or -.Ic nixos-rebuild boot -remain available in the GRUB menu. -.Pp -Note that if you are using specializations, running just -.Ic nixos-rebuild switch -will switch you back to the unspecialized, base system \(em in that case, you -might want to use this instead: -.Bd -literal -offset indent -$ nixos-rebuild switch --specialisation your-specialisation-name -.Ed -.Pp -This command will build all specialisations and make them bootable just -like regular -.Ic nixos-rebuild switch -does \(em the only thing different is that it will switch to given -specialisation instead of the base system; it can be also used to switch from -the base system into a specialised one, or to switch between specialisations. -. -.It Cm boot -Build the new configuration and make it the boot default (as with -.Ic nixos-rebuild switch Ns -), but do not activate it. That is, the system continues to run the previous -configuration until the next reboot. -. -.It Cm test -Build and activate the new configuration, but do not add it to the GRUB -boot menu. Thus, if you reboot the system (or if it crashes), you will -automatically revert to the default configuration (i.e. the -configuration resulting from the last call to -.Ic nixos-rebuild switch -or -.Ic nixos-rebuild boot Ns -). -.Pp -Note that if you are using specialisations, running just -.Ic nixos-rebuild test -will activate the unspecialised, base system \(em in that case, you might want -to use this instead: -.Bd -literal -offset indent -$ nixos-rebuild test --specialisation your-specialisation-name -.Ed -.Pp -This command can be also used to switch from the base system into a -specialised one, or to switch between specialisations. -. -.It Cm build -Build the new configuration, but neither activate it nor add it to the -GRUB boot menu. It leaves a symlink named -.Pa result -in the current directory, which points to the output of the top-level -.Dq system -derivation. This is essentially the same as doing -.Bd -literal -offset indent -$ nix-build /path/to/nixpkgs/nixos -A system -.Ed -.Pp -Note that you do not need to be root to run -.Ic nixos-rebuild build Ns -\&. -. -.It Cm dry-build -Show what store paths would be built or downloaded by any of the -operations above, but otherwise do nothing. -. -.It Cm dry-activate -Build the new configuration, but instead of activating it, show what -changes would be performed by the activation (i.e. by -.Ic nixos-rebuild test Ns -). For instance, this command will print which systemd units would be restarted. -The list of changes is not guaranteed to be complete. -. -.It Cm edit -Opens -.Pa configuration.nix -in the default editor. -. -.It Cm repl -Opens the configuration in -.Ic nix repl Ns . -. -.It Cm build-vm -Build a script that starts a NixOS virtual machine with the desired -configuration. It leaves a symlink -.Pa result -in the current directory that points (under -.Ql result/bin/run\- Ns Va hostname Ns \-vm Ns -) -at the script that starts the VM. Thus, to test a NixOS configuration in -a virtual machine, you should do the following: -.Bd -literal -offset indent -$ nixos-rebuild build-vm -$ ./result/bin/run-*-vm -.Ed -.Pp -The VM is implemented using the -.Ql qemu -package. For best performance, you should load the -.Ql kvm-intel -or -.Ql kvm-amd -kernel modules to get hardware virtualisation. -.Pp -The VM mounts the Nix store of the host through the 9P file system. The -host Nix store is read-only, so Nix commands that modify the Nix store -will not work in the VM. This includes commands such as -.Nm Ns -; to change the VM’s configuration, you must halt the VM and re-run the commands -above. -.Pp -The VM has its own ext3 root file system, which is automatically created when -the VM is first started, and is persistent across reboots of the VM. It is -stored in -.Ql ./ Ns Va hostname Ns .qcow2 Ns -\&. -.\" The entire file system hierarchy of the host is available in -.\" the VM under -.\" .Pa /hostfs Ns -.\" . -. -.It Cm build-vm-with-bootloader -Like -.Cm build-vm Ns -, but boots using the regular boot loader of your configuration (e.g. GRUB 1 or -2), rather than booting directly into the kernel and initial ramdisk of the -system. This allows you to test whether the boot loader works correctly. \ -However, it does not guarantee that your NixOS configuration will boot -successfully on the host hardware (i.e., after running -.Ic nixos-rebuild switch Ns -), because the hardware and boot loader configuration in the VM are different. -The boot loader is installed on an automatically generated virtual disk -containing a -.Pa /boot -partition. -. -.It Cm list-generations Op Fl -json -List the available generations in a similar manner to the boot loader -menu. It shows the generation number, build date and time, NixOS version, -kernel version and the configuration revision. -There is also a json version of output available. -.El -. -. -. -.Sh OPTIONS -.Bl -tag -width indent -.It Fl -upgrade , -upgrade-all -Update the root user's channel named -.Ql nixos -before rebuilding the system. -.Pp -In addition to the -.Ql nixos -channel, the root user's channels which have a file named -.Ql .update-on-nixos-rebuild -in their base directory will also be updated. -.Pp -Passing -.Fl -upgrade-all -updates all of the root user's channels. -. -.It Fl -install-bootloader -Causes the boot loader to be (re)installed on the device specified by the -relevant configuration options. -. -.It Fl -no-build-nix -Normally, -.Nm -first builds the -.Ql nixUnstable -attribute in Nixpkgs, and uses the resulting instance of the Nix package manager -to build the new system configuration. This is necessary if the NixOS modules -use features not provided by the currently installed version of Nix. This option -disables building a new Nix. -. -.It Fl -fast -Equivalent to -.Fl -no-build-nix Ns -\&. This option is useful if you call -.Nm -frequently (e.g. if you’re hacking on a NixOS module). -. -.It Fl -rollback -Instead of building a new configuration as specified by -.Pa /etc/nixos/configuration.nix Ns -, roll back to the previous configuration. (The previous configuration is -defined as the one before the “current” generation of the Nix profile -.Pa /nix/var/nix/profiles/system Ns -\&.) -. -.It Fl -builders Ar builder-spec -Allow ad-hoc remote builders for building the new system. This requires -the user executing -.Nm -(usually root) to be configured as a trusted user in the Nix daemon. This can be -achieved by using the -.Va nix.settings.trusted-users -NixOS option. Examples values for that option are described in the -.Dq Remote builds -chapter in the Nix manual, (i.e. -.Ql --builders \(dqssh://bigbrother x86_64-linux\(dq Ns -). By specifying an empty string existing builders specified in -.Pa /etc/nix/machines -can be ignored: -.Ql --builders \(dq\(dq -for example when they are not reachable due to network connectivity. -. -.It Fl -profile-name Ar name , Fl p Ar name -Instead of using the Nix profile -.Pa /nix/var/nix/profiles/system -to keep track of the current and previous system configurations, use -.Pa /nix/var/nix/profiles/system-profiles/ Ns Va name Ns -\&. When you use GRUB 2, for every system profile created with this flag, NixOS -will create a submenu named -.Dq NixOS - Profile Va name -in GRUB’s boot menu, containing the current and previous configurations of this profile. -.Pp -For instance, if you want to test a configuration file named -.Pa test.nix -without affecting the default system profile, you would do: -.Bd -literal -offset indent -$ nixos-rebuild switch -p test -I nixos-config=./test.nix -.Ed -.Pp -The new configuration will appear in the GRUB 2 submenu -.Dq NixOS - Profile 'test' Ns -\&. -. -.It Fl -specialisation Ar name , Fl c Ar name -Activates given specialisation; when not specified, switching and testing -will activate the base, unspecialised system. -. -.It Fl -build-host Ar host -Instead of building the new configuration locally, use the specified host -to perform the build. The host needs to be accessible with -.Ic ssh Ns , -and must be able to perform Nix builds. If the option -.Fl -target-host -is not set, the build will be copied back to the local machine when done. -.Pp -Note that, if -.Fl -no-build-nix -is not specified, Nix will be built both locally and remotely. This is because -the configuration will always be evaluated locally even though the building -might be performed remotely. -.Pp -You can include a remote user name in the host name -.Ns ( Va user@host Ns -). You can also set ssh options by defining the -.Ev NIX_SSHOPTS -environment variable. -. -.It Fl -target-host Ar host -Specifies the NixOS target host. By setting this to something other than an -empty string, the system activation will happen on the remote host instead of -the local machine. The remote host needs to be accessible over -.Ic ssh Ns , -and for the commands -.Cm switch Ns -, -.Cm boot -and -.Cm test -you need root access. -.Pp -If -.Fl -build-host -is not explicitly specified or empty, building will take place locally. -.Pp -You can include a remote user name in the host name -.Ns ( Va user@host Ns -). You can also set ssh options by defining the -.Ev NIX_SSHOPTS -environment variable. -.Pp -Note that -.Nm -honors the -.Va nixpkgs.crossSystem -setting of the given configuration but disregards the true architecture of the -target host. Hence the -.Va nixpkgs.crossSystem -setting has to match the target platform or else activation will fail. -. -.It Fl -use-substitutes -When set, nixos-rebuild will add -.Fl -use-substitutes -to each invocation of nix-copy-closure. This will only affect the behavior of -nixos-rebuild if -.Fl -target-host -or -.Fl -build-host -is also set. This is useful when the target-host connection to cache.nixos.org -is faster than the connection between hosts. -. -.It Fl -use-remote-sudo -When set, nixos-rebuild prefixes activation commands that run on the -.Fl -target-host -system with -.Ic sudo Ns -\&. Setting this option allows deploying as a non-root user. -. -.It Fl -file Ar path , Fl F Ar path -Enable and build the NixOS system from the specified file. The file must -evaluate to an attribute set, and it must contain a valid NixOS configuration -at attribute -.Va attrPath Ns -\&. This is useful for building a NixOS system from a nix file that is not -a flake or a NixOS configuration module. Attribute set a with valid NixOS -configuration can be made using -.Va nixos -function in nixpkgs or importing and calling -.Pa nixos/lib/eval-config.nix -from nixpkgs. If specified without -.Fl -attr -option, builds the configuration from the top-level -attribute of the file. -. -.It Fl -attr Ar attrPath , Fl A Ar attrPath -Enable and build the NixOS system from nix file and use the specified attribute -path from file specified by the -.Fl -file -option. If specified without -.Fl -file -option, uses -.Pa default.nix -in current directory. -. -.It Fl -flake Va flake-uri Ns Op Va #name -Build the NixOS system from the specified flake. It defaults to the directory -containing the target of the symlink -.Pa /etc/nixos/flake.nix Ns -, if it exists. The flake must contain an output named -.Ql nixosConfigurations. Ns Va name Ns -\&. If -.Va name -is omitted, it default to the current host name. -. -.It Fl -no-flake -Do not imply -.Fl -flake -if -.Pa /etc/nixos/flake.nix -exists. With this option, it is possible to build non-flake NixOS configurations -even if the current NixOS systems uses flakes. -.El -.Pp -In addition, -.Nm -accepts following options from nix commands that the tool calls: -. -.Pp -flake-related options: -.Bd -offset indent -.Fl -recreate-lock-file Ns , -.Fl -no-update-lock-file Ns , -.Fl -no-write-lock-file Ns , -.Fl -no-registries Ns , -.Fl -commit-lock-file Ns , -.Fl -update-input Ar input-path Ns , -.Fl -override-input Ar input-path flake-url Ns -.Ed -. -.Pp -Builder options: -.Bd -offset indent -.Fl -verbose Ns , -.Fl v Ns , -.Fl -quiet Ns , -.Fl -log-format Ns , -.Fl -no-build-output Ns , -.Fl Q Ns , -.Fl -max-jobs Ns , -.Fl j Ns , -.Fl -cores Ns , -.Fl -keep-going Ns , -.Fl k Ns , -.Fl -keep-failed Ns , -.Fl K Ns , -.Fl -fallback Ns , -.Fl I Ns , -.Fl -option Ns -.Fl -repair Ns , -.Fl -builders Ns , -.Fl -accept-flake-config Ns , -.Fl -print-build-logs Ns , -.Fl L Ns , -.Fl -show-trace Ns , -.Fl -refresh Ns , -.Fl -impure Ns , -.Fl -offline Ns , -.Fl -no-net Ns -.Ed -. -.Pp -See the Nix manual, -.Ic nix flake lock --help -or -.Ic nix-build --help -for details. -. -. -. -.Sh ENVIRONMENT -.Bl -tag -width indent -.It Ev NIXOS_CONFIG -Path to the main NixOS configuration module. Defaults to -.Pa /etc/nixos/configuration.nix Ns -\&. -. -.It Ev NIX_PATH -A colon-separated list of directories used to look up Nix expressions enclosed -in angle brackets (e.g. ). Example: -.Bd -literal -offset indent -nixpkgs=./my-nixpkgs -.Ed -. -.It Ev NIX_SSHOPTS -Additional options to be passed to -.Ic ssh -on the command line. -.Ed -. -.It Ev NIXOS_SWITCH_USE_DIRTY_ENV -Expose the the current environment variables to post activation scripts. Will -skip usage of -.Ic systemd-run -during system activation. Possibly dangerous, specially in remote environments -(e.g.: via SSH). Will be removed in the future. -.El -. -. -. -.Sh FILES -.Bl -tag -width indent -.It Pa /etc/nixos/flake.nix -If this file exists, then -.Nm -will use it as if the -.Fl -flake -option was given. This file may be a symlink to a -.Pa flake.nix -in an actual flake; thus -.Pa /etc/nixos -need not be a flake. -. -.It Pa /run/current-system -A symlink to the currently active system configuration in the Nix store. -. -.It Pa /nix/var/nix/profiles/system -The Nix profile that contains the current and previous system -configurations. Used to generate the GRUB boot menu. -.El -. -. -. -.Sh BUGS -This command should be renamed to something more descriptive. -. -. -. -.Sh AUTHORS -.An -nosplit -.An Eelco Dolstra -and -.An the Nixpkgs/NixOS contributors diff --git a/pkgs/by-name/ni/nixos-rebuild/nixos-rebuild.sh b/pkgs/by-name/ni/nixos-rebuild/nixos-rebuild.sh deleted file mode 100755 index 5cfff7a..0000000 --- a/pkgs/by-name/ni/nixos-rebuild/nixos-rebuild.sh +++ /dev/null @@ -1,874 +0,0 @@ -#! @runtimeShell@ -# shellcheck shell=bash - -if [ -x "@runtimeShell@" ]; then export SHELL="@runtimeShell@"; fi; - -set -e -set -o pipefail -shopt -s inherit_errexit - -export PATH=@path@:$PATH - -showSyntax() { - exec man nixos-rebuild - exit 1 -} - - -# Parse the command line. -origArgs=("$@") -copyFlags=() -extraBuildFlags=() -lockFlags=() -flakeFlags=(--extra-experimental-features 'nix-command flakes') -action= -buildNix=1 -fast= -rollback= -upgrade= -upgrade_all= -profile=/nix/var/nix/profiles/system -specialisation= -buildHost= -targetHost= -remoteSudo= -verboseScript= -noFlake= -attr= -buildFile=default.nix -buildingAttribute=1 -installBootloader= -json= - -# log the given argument to stderr -log() { - echo "$@" >&2 -} - -while [ "$#" -gt 0 ]; do - i="$1"; shift 1 - case "$i" in - --help) - showSyntax - ;; - switch|boot|test|build|edit|repl|dry-build|dry-run|dry-activate|build-vm|build-vm-with-bootloader|list-generations) - if [ "$i" = dry-run ]; then i=dry-build; fi - if [ "$i" = list-generations ]; then - buildNix= - fast=1 - fi - # exactly one action mandatory, bail out if multiple are given - if [ -n "$action" ]; then showSyntax; fi - action="$i" - ;; - --file|-f) - if [ -z "$1" ]; then - log "$0: ‘--file’ requires an argument" - exit 1 - fi - buildFile="$1" - buildingAttribute= - shift 1 - ;; - --attr|-A) - if [ -z "$1" ]; then - log "$0: ‘--attr’ requires an argument" - exit 1 - fi - attr="$1" - buildingAttribute= - shift 1 - ;; - --install-grub) - log "$0: --install-grub deprecated, use --install-bootloader instead" - installBootloader=1 - ;; - --install-bootloader) - installBootloader=1 - ;; - --no-build-nix) - buildNix= - ;; - --rollback) - rollback=1 - ;; - --upgrade) - upgrade=1 - ;; - --upgrade-all) - upgrade=1 - upgrade_all=1 - ;; - --use-substitutes|--substitute-on-destination|-s) - copyFlags+=("-s") - ;; - -I|--max-jobs|-j|--cores|--builders|--log-format) - j="$1"; shift 1 - extraBuildFlags+=("$i" "$j") - ;; - --accept-flake-config|-j*|--quiet|--print-build-logs|-L|--no-build-output|-Q| --show-trace|--keep-going|-k|--keep-failed|-K|--fallback|--refresh|--repair|--impure|--offline|--no-net) - extraBuildFlags+=("$i") - ;; - --verbose|-v|-vv|-vvv|-vvvv|-vvvvv) - verboseScript="true" - extraBuildFlags+=("$i") - ;; - --option) - j="$1"; shift 1 - k="$1"; shift 1 - extraBuildFlags+=("$i" "$j" "$k") - ;; - --fast) - buildNix= - fast=1 - ;; - --profile-name|-p) - if [ -z "$1" ]; then - log "$0: ‘--profile-name’ requires an argument" - exit 1 - fi - if [ "$1" != system ]; then - profile="/nix/var/nix/profiles/system-profiles/$1" - mkdir -p -m 0755 "$(dirname "$profile")" - fi - shift 1 - ;; - --specialisation|-c) - if [ -z "$1" ]; then - log "$0: ‘--specialisation’ requires an argument" - exit 1 - fi - specialisation="$1" - shift 1 - ;; - --build-host) - buildHost="$1" - shift 1 - ;; - --target-host) - targetHost="$1" - shift 1 - ;; - --use-remote-sudo) - remoteSudo=1 - ;; - --flake) - flake="$1" - shift 1 - ;; - --no-flake) - noFlake=1 - ;; - --recreate-lock-file|--no-update-lock-file|--no-write-lock-file|--no-registries|--commit-lock-file) - lockFlags+=("$i") - ;; - --update-input) - j="$1"; shift 1 - lockFlags+=("$i" "$j") - ;; - --override-input) - j="$1"; shift 1 - k="$1"; shift 1 - lockFlags+=("$i" "$j" "$k") - ;; - --json) - json=1 - ;; - *) - log "$0: unknown option \`$i'" - exit 1 - ;; - esac -done - -if [[ -n "$SUDO_USER" ]]; then - useSudo=1 -fi - -# log the given argument to stderr if verbose mode is on -logVerbose() { - if [ -n "$verboseScript" ]; then - echo "$@" >&2 - fi -} - -# Run a command, logging it first if verbose mode is on -runCmd() { - logVerbose "$" "$@" - "$@" -} - -buildHostCmd() { - local c - if [[ "${useSudo:-x}" = 1 ]]; then - c=("sudo") - else - c=() - fi - - if [ -z "$buildHost" ]; then - runCmd "$@" - elif [ -n "$remoteNix" ]; then - runCmd ssh $SSHOPTS "$buildHost" "${c[@]}" env PATH="$remoteNix":'$PATH' "$@" - else - runCmd ssh $SSHOPTS "$buildHost" "${c[@]}" "$@" - fi -} - -targetHostCmd() { - local c - if [[ "${useSudo:-x}" = 1 ]]; then - c=("sudo") - else - c=() - fi - - if [ -z "$targetHost" ]; then - runCmd "${c[@]}" "$@" - else - runCmd ssh $SSHOPTS "$targetHost" "${c[@]}" "$@" - fi -} - -targetHostSudoCmd() { - if [ -n "$remoteSudo" ]; then - useSudo=1 SSHOPTS="$SSHOPTS -t" targetHostCmd "$@" - else - # While a tty might not be necessary, we apply it to be consistent with - # sudo usage, and an experience that is more consistent with local deployment. - SSHOPTS="$SSHOPTS -t" targetHostCmd "$@" - fi -} - -copyToTarget() { - if ! [ "$targetHost" = "$buildHost" ]; then - if [ -z "$targetHost" ]; then - logVerbose "Running nix-copy-closure with these NIX_SSHOPTS: $SSHOPTS" - NIX_SSHOPTS=$SSHOPTS runCmd nix-copy-closure "${copyFlags[@]}" --from "$buildHost" "$1" - elif [ -z "$buildHost" ]; then - logVerbose "Running nix-copy-closure with these NIX_SSHOPTS: $SSHOPTS" - NIX_SSHOPTS=$SSHOPTS runCmd nix-copy-closure "${copyFlags[@]}" --to "$targetHost" "$1" - else - buildHostCmd nix-copy-closure "${copyFlags[@]}" --to "$targetHost" "$1" - fi - fi -} - -nixBuild() { - logVerbose "Building in legacy (non-flake) mode." - if [ -z "$buildHost" ]; then - logVerbose "No --build-host given, running nix-build locally" - runCmd nix-build "$@" - else - logVerbose "buildHost set to \"$buildHost\", running nix-build remotely" - local instArgs=() - local buildArgs=() - local drv= - - while [ "$#" -gt 0 ]; do - local i="$1"; shift 1 - case "$i" in - -o) - local out="$1"; shift 1 - buildArgs+=("--add-root" "$out" "--indirect") - ;; - -A) - local j="$1"; shift 1 - instArgs+=("$i" "$j") - ;; - -I) # We don't want this in buildArgs - shift 1 - ;; - --no-out-link) # We don't want this in buildArgs - ;; - "<"*) # nix paths - instArgs+=("$i") - ;; - *) - buildArgs+=("$i") - ;; - esac - done - - drv="$(runCmd nix-instantiate "${instArgs[@]}" "${extraBuildFlags[@]}")" - if [ -a "$drv" ]; then - logVerbose "Running nix-copy-closure with these NIX_SSHOPTS: $SSHOPTS" - NIX_SSHOPTS=$SSHOPTS runCmd nix-copy-closure --to "$buildHost" "$drv" - buildHostCmd nix-store -r "$drv" "${buildArgs[@]}" - else - log "nix-instantiate failed" - exit 1 - fi - fi -} - -nixFlakeBuild() { - logVerbose "Building in flake mode." - if [[ -z "$buildHost" && -z "$targetHost" && "$action" != switch && "$action" != boot && "$action" != test && "$action" != dry-activate ]] - then - runCmd nix "${flakeFlags[@]}" build "$@" - readlink -f ./result - elif [ -z "$buildHost" ]; then - runCmd nix "${flakeFlags[@]}" build "$@" --out-link "${tmpDir}/result" - readlink -f "${tmpDir}/result" - else - local attr="$1" - shift 1 - local evalArgs=() - local buildArgs=() - local drv= - - while [ "$#" -gt 0 ]; do - local i="$1"; shift 1 - case "$i" in - --recreate-lock-file|--no-update-lock-file|--no-write-lock-file|--no-registries|--commit-lock-file) - evalArgs+=("$i") - ;; - --update-input) - local j="$1"; shift 1 - evalArgs+=("$i" "$j") - ;; - --override-input) - local j="$1"; shift 1 - local k="$1"; shift 1 - evalArgs+=("$i" "$j" "$k") - ;; - --impure) # We don't want this in buildArgs, it's only needed at evaluation time, and unsupported during realisation - ;; - *) - buildArgs+=("$i") - ;; - esac - done - - drv="$(runCmd nix "${flakeFlags[@]}" eval --raw "${attr}.drvPath" "${evalArgs[@]}" "${extraBuildFlags[@]}")" - if [ -a "$drv" ]; then - logVerbose "Running nix with these NIX_SSHOPTS: $SSHOPTS" - NIX_SSHOPTS=$SSHOPTS runCmd nix "${flakeFlags[@]}" copy "${copyFlags[@]}" --derivation --to "ssh://$buildHost" "$drv" - buildHostCmd nix-store -r "$drv" "${buildArgs[@]}" - else - log "nix eval failed" - exit 1 - fi - fi -} - - -if [ -z "$action" ]; then showSyntax; fi - -# Only run shell scripts from the Nixpkgs tree if the action is -# "switch", "boot", or "test". With other actions (such as "build"), -# the user may reasonably expect that no code from the Nixpkgs tree is -# executed, so it's safe to run nixos-rebuild against a potentially -# untrusted tree. -canRun= -if [[ "$action" = switch || "$action" = boot || "$action" = test ]]; then - canRun=1 -fi - -# Verify that user is not trying to use attribute building and flake -# at the same time -if [[ -z $buildingAttribute && -n $flake ]]; then - log "error: '--flake' cannot be used with '--file' or '--attr'" - exit 1 -fi - -# If ‘--upgrade’ or `--upgrade-all` is given, -# run ‘nix-channel --update nixos’. -if [[ -n $upgrade && -z $_NIXOS_REBUILD_REEXEC && -z $flake ]]; then - # If --upgrade-all is passed, or there are other channels that - # contain a file called ".update-on-nixos-rebuild", update them as - # well. Also upgrade the nixos channel. - - for channelpath in /nix/var/nix/profiles/per-user/root/channels/*; do - channel_name=$(basename "$channelpath") - - if [[ "$channel_name" == "nixos" ]]; then - runCmd nix-channel --update "$channel_name" - elif [ -e "$channelpath/.update-on-nixos-rebuild" ]; then - runCmd nix-channel --update "$channel_name" - elif [[ -n $upgrade_all ]] ; then - runCmd nix-channel --update "$channel_name" - fi - done -fi - -# Make sure that we use the Nix package we depend on, not something -# else from the PATH for nix-{env,instantiate,build}. This is -# important, because NixOS defaults the architecture of the rebuilt -# system to the architecture of the nix-* binaries used. So if on an -# amd64 system the user has an i686 Nix package in her PATH, then we -# would silently downgrade the whole system to be i686 NixOS on the -# next reboot. -if [ -z "$_NIXOS_REBUILD_REEXEC" ]; then - export PATH=@nix@/bin:$PATH -fi - -# Use /etc/nixos/flake.nix if it exists. It can be a symlink to the -# actual flake. -if [[ -z $flake && -e /etc/nixos/flake.nix && -z $noFlake ]]; then - flake="$(dirname "$(readlink -f /etc/nixos/flake.nix)")" -fi - -# For convenience, use the hostname as the default configuration to -# build from the flake. -if [[ -n $flake ]]; then - if [[ $flake =~ ^(.*)\#([^\#\"]*)$ ]]; then - flake="${BASH_REMATCH[1]}" - flakeAttr="${BASH_REMATCH[2]}" - fi - if [[ -z $flakeAttr ]]; then - hostname="$(targetHostCmd cat /proc/sys/kernel/hostname)" - if [[ -z $hostname ]]; then - hostname=default - fi - flakeAttr="nixosConfigurations.\"$hostname\"" - else - flakeAttr="nixosConfigurations.\"$flakeAttr\"" - fi -fi - -if [[ ! -z "$specialisation" && ! "$action" = switch && ! "$action" = test ]]; then - log "error: ‘--specialisation’ can only be used with ‘switch’ and ‘test’" - exit 1 -fi - -tmpDir=$(mktemp -t -d nixos-rebuild.XXXXXX) - -if [[ ${#tmpDir} -ge 60 ]]; then - # Very long tmp dirs lead to "too long for Unix domain socket" - # SSH ControlPath errors. Especially macOS sets long TMPDIR paths. - rmdir "$tmpDir" - tmpDir=$(TMPDIR= mktemp -t -d nixos-rebuild.XXXXXX) -fi - -cleanup() { - for ctrl in "$tmpDir"/ssh-*; do - ssh -o ControlPath="$ctrl" -O exit dummyhost 2>/dev/null || true - done - rm -rf "$tmpDir" -} -trap cleanup EXIT - - -# Re-execute nixos-rebuild from the Nixpkgs tree. -if [[ -z $_NIXOS_REBUILD_REEXEC && -n $canRun && -z $fast ]]; then - if [[ -z $buildingAttribute ]]; then - p=$(runCmd nix-build --no-out-link $buildFile -A "${attr:+$attr.}config.system.build.nixos-rebuild" "${extraBuildFlags[@]}") - SHOULD_REEXEC=1 - elif [[ -z $flake ]]; then - if p=$(runCmd nix-build --no-out-link --expr 'with import {}; config.system.build.nixos-rebuild' "${extraBuildFlags[@]}"); then - SHOULD_REEXEC=1 - fi - else - runCmd nix "${flakeFlags[@]}" build --out-link "${tmpDir}/nixos-rebuild" "$flake#$flakeAttr.config.system.build.nixos-rebuild" "${extraBuildFlags[@]}" "${lockFlags[@]}" - if p=$(readlink -e "${tmpDir}/nixos-rebuild"); then - SHOULD_REEXEC=1 - fi - fi - - if [[ -n $SHOULD_REEXEC ]]; then - export _NIXOS_REBUILD_REEXEC=1 - # Manually call cleanup as the EXIT trap is not triggered when using exec - cleanup - runCmd exec "$p/bin/nixos-rebuild" "${origArgs[@]}" - exit 1 - fi -fi - -# Find configuration.nix and open editor instead of building. -if [ "$action" = edit ]; then - if [[ -n $attr || -n $buildFile ]]; then - log "error: '--file' and '--attr' are not supported with 'edit'" - exit 1 - elif [[ -z $flake ]]; then - NIXOS_CONFIG=${NIXOS_CONFIG:-$(runCmd nix-instantiate --find-file nixos-config)} - if [[ -d $NIXOS_CONFIG ]]; then - NIXOS_CONFIG=$NIXOS_CONFIG/default.nix - fi - runCmd exec ${EDITOR:-nano} "$NIXOS_CONFIG" - else - runCmd exec nix "${flakeFlags[@]}" edit "${lockFlags[@]}" -- "$flake#$flakeAttr" - fi - exit 1 -fi - -SSHOPTS="$NIX_SSHOPTS -o ControlMaster=auto -o ControlPath=$tmpDir/ssh-%n -o ControlPersist=60" - -# First build Nix, since NixOS may require a newer version than the -# current one. -if [[ -n "$rollback" || "$action" = dry-build ]]; then - buildNix= -fi - -nixSystem() { - machine="$(uname -m)" - if [[ "$machine" =~ i.86 ]]; then - machine=i686 - fi - echo $machine-linux -} - -prebuiltNix() { - machine="$1" - if [ "$machine" = x86_64 ]; then - echo @nix_x86_64_linux@ - elif [[ "$machine" =~ i.86 ]]; then - echo @nix_i686_linux@ - elif [[ "$machine" = aarch64 ]]; then - echo @nix_aarch64_linux@ - else - log "$0: unsupported platform" - exit 1 - fi -} - -getNixDrv() { - nixDrv= - - if [[ -z $buildingAttribute ]]; then - if nixDrv="$(runCmd nix-instantiate $buildFile --add-root "$tmpDir/nix.drv" --indirect -A ${attr:+$attr.}config.nix.package.out "${extraBuildFlags[@]}")"; then return; fi - fi - if nixDrv="$(runCmd nix-instantiate '' --add-root "$tmpDir/nix.drv" --indirect -A config.nix.package.out "${extraBuildFlags[@]}")"; then return; fi - if nixDrv="$(runCmd nix-instantiate '' --add-root "$tmpDir/nix.drv" --indirect -A nix "${extraBuildFlags[@]}")"; then return; fi - - if ! nixStorePath="$(runCmd nix-instantiate --eval '' -A "$(nixSystem)" | sed -e 's/^"//' -e 's/"$//')"; then - nixStorePath="$(prebuiltNix "$(uname -m)")" - fi - if ! runCmd nix-store -r "$nixStorePath" --add-root "${tmpDir}/nix" --indirect \ - --option extra-binary-caches https://cache.nixos.org/; then - log "warning: don't know how to get latest Nix" - fi - # Older version of nix-store -r don't support --add-root. - [ -e "$tmpDir/nix" ] || ln -sf "$nixStorePath" "$tmpDir/nix" - if [ -n "$buildHost" ]; then - remoteNixStorePath="$(runCmd prebuiltNix "$(buildHostCmd uname -m)")" - remoteNix="$remoteNixStorePath/bin" - if ! buildHostCmd nix-store -r "$remoteNixStorePath" \ - --option extra-binary-caches https://cache.nixos.org/ >/dev/null; then - remoteNix= - log "warning: don't know how to get latest Nix" - fi - fi -} - -if [[ -n $buildNix && -z $flake ]]; then - log "building Nix..." - getNixDrv - if [ -a "$nixDrv" ]; then - nix-store -r "$nixDrv"'!'"out" --add-root "$tmpDir/nix" --indirect >/dev/null - if [ -n "$buildHost" ]; then - nix-copy-closure "${copyFlags[@]}" --to "$buildHost" "$nixDrv" - # The nix build produces multiple outputs, we add them all to the remote path - for p in $(buildHostCmd nix-store -r "$(readlink "$nixDrv")" "${buildArgs[@]}"); do - remoteNix="$remoteNix${remoteNix:+:}$p/bin" - done - fi - fi - PATH="$tmpDir/nix/bin:$PATH" -fi - - -# Update the version suffix if we're building from Git (so that -# nixos-version shows something useful). -if [[ -n $canRun && -z $flake ]]; then - if nixpkgs=$(runCmd nix-instantiate --find-file nixpkgs "${extraBuildFlags[@]}"); then - suffix=$(runCmd $SHELL "$nixpkgs/nixos/modules/installer/tools/get-version-suffix" "${extraBuildFlags[@]}" || true) - if [ -n "$suffix" ]; then - echo -n "$suffix" > "$nixpkgs/.version-suffix" || true - fi - fi -fi - - -if [ "$action" = dry-build ]; then - extraBuildFlags+=(--dry-run) -fi - -if [ "$action" = repl ]; then - # This is a very end user command, implemented using sub-optimal means. - # You should feel free to improve its behavior, as well as resolve tech - # debt in "breaking" ways. Humans adapt quite well. - if [[ -z $buildingAttribute ]]; then - exec nix repl --file $buildFile $attr "${extraBuildFlags[@]}" - elif [[ -z $flake ]]; then - exec nix repl '' "${extraBuildFlags[@]}" - else - if [[ -n "${lockFlags[0]}" ]]; then - # nix repl itself does not support locking flags - log "nixos-rebuild repl does not support locking flags yet" - exit 1 - fi - d='$' - q='"' - bold="$(echo -e '\033[1m')" - blue="$(echo -e '\033[34;1m')" - attention="$(echo -e '\033[35;1m')" - reset="$(echo -e '\033[0m')" - if [[ -e $flake ]]; then - flakePath=$(realpath "$flake") - else - flakePath=$flake - fi - # This nix repl invocation is impure, because usually the flakeref is. - # For a solution that preserves the motd and custom scope, we need - # something like https://github.com/NixOS/nix/issues/8679. - exec nix repl --impure --expr " - let flake = builtins.getFlake ''$flakePath''; - configuration = flake.$flakeAttr; - motd = '' - $d{$q\n$q} - Hello and welcome to the NixOS configuration - $flakeAttr - in $flake - - The following is loaded into nix repl's scope: - - - ${blue}config${reset} All option values - - ${blue}options${reset} Option data and metadata - - ${blue}pkgs${reset} Nixpkgs package set - - ${blue}lib${reset} Nixpkgs library functions - - other module arguments - - - ${blue}flake${reset} Flake outputs, inputs and source info of $flake - - Use tab completion to browse around ${blue}config${reset}. - - Use ${bold}:r${reset} to ${bold}reload${reset} everything after making a change in the flake. - (assuming $flake is a mutable flake ref) - - See ${bold}:?${reset} for more repl commands. - - ${attention}warning:${reset} nixos-rebuild repl does not currently enforce pure evaluation. - ''; - scope = - assert configuration._type or null == ''configuration''; - assert configuration.class or ''nixos'' == ''nixos''; - configuration._module.args // - configuration._module.specialArgs // - { - inherit (configuration) config options; - lib = configuration.lib or configuration.pkgs.lib; - inherit flake; - }; - in builtins.seq scope builtins.trace motd scope - " "${extraBuildFlags[@]}" - fi -fi - -if [ "$action" = list-generations ]; then - if [ ! -L "$profile" ]; then - log "No profile \`$(basename "$profile")' found" - exit 1 - fi - - generation_from_dir() { - generation_dir="$1" - generation_base="$(basename "$generation_dir")" # Has the format "system-123-link" for generation 123 - no_link_gen="${generation_base%-link}" # remove the "-link" - echo "${no_link_gen##*-}" # remove everything before the last dash - } - describe_generation(){ - generation_dir="$1" - generation_number="$(generation_from_dir "$generation_dir")" - nixos_version="$(cat "$generation_dir/nixos-version" 2> /dev/null || echo "Unknown")" - - kernel_dir="$(dirname "$(realpath "$generation_dir/kernel")")" - kernel_version="$(ls "$kernel_dir/lib/modules" || echo "Unknown")" - - configurationRevision="$("$generation_dir/sw/bin/nixos-version" --configuration-revision 2> /dev/null || true)" - - # Old nixos-version output ignored unknown flags and just printed the version - # therefore the following workaround is done not to show the default output - nixos_version_default="$("$generation_dir/sw/bin/nixos-version")" - if [ "$configurationRevision" == "$nixos_version_default" ]; then - configurationRevision="" - fi - - # jq automatically quotes the output => don't try to quote it in output! - build_date="$(stat "$generation_dir" --format=%W | jq 'todate')" - - pushd "$generation_dir/specialisation/" > /dev/null || : - specialisation_list=(*) - popd > /dev/null || : - - specialisations="$(jq --compact-output --null-input '$ARGS.positional' --args -- "${specialisation_list[@]}")" - - if [ "$(basename "$generation_dir")" = "$(readlink "$profile")" ]; then - current_generation_tag="true" - else - current_generation_tag="false" - fi - - # Escape userdefined strings - nixos_version="$(jq -aR <<< "$nixos_version")" - kernel_version="$(jq -aR <<< "$kernel_version")" - configurationRevision="$(jq -aR <<< "$configurationRevision")" - cat << EOF -{ - "generation": $generation_number, - "date": $build_date, - "nixosVersion": $nixos_version, - "kernelVersion": $kernel_version, - "configurationRevision": $configurationRevision, - "specialisations": $specialisations, - "current": $current_generation_tag -} -EOF - } - - find "$(dirname "$profile")" -regex "$profile-[0-9]+-link" | - sort -Vr | - while read -r generation_dir; do - describe_generation "$generation_dir" - done | - if [ -z "$json" ]; then - jq --slurp -r '.[] | [ - ([.generation, (if .current == true then "current" else "" end)] | join(" ")), - (.date | fromdate | strflocaltime("%Y-%m-%d %H:%M:%S")), - .nixosVersion, .kernelVersion, .configurationRevision, - (.specialisations | join(" ")) - ] | @tsv' | - column --separator $'\t' --table --table-columns "Generation,Build-date,NixOS version,Kernel,Configuration Revision,Specialisation" | - ${PAGER:cat} - else - jq --slurp . - fi - exit 0 -fi - - -# Either upgrade the configuration in the system profile (for "switch" -# or "boot"), or just build it and create a symlink "result" in the -# current directory (for "build" and "test"). -if [ -z "$rollback" ]; then - log "building the system configuration..." - if [[ "$action" = switch || "$action" = boot ]]; then - if [[ -z $buildingAttribute ]]; then - pathToConfig="$(nixBuild $buildFile -A "${attr:+$attr.}config.system.build.toplevel" "${extraBuildFlags[@]}")" - elif [[ -z $flake ]]; then - pathToConfig="$(nixBuild '' --no-out-link -A system "${extraBuildFlags[@]}")" - else - pathToConfig="$(nixFlakeBuild "$flake#$flakeAttr.config.system.build.toplevel" "${extraBuildFlags[@]}" "${lockFlags[@]}")" - fi - copyToTarget "$pathToConfig" - targetHostSudoCmd nix-env -p "$profile" --set "$pathToConfig" - elif [[ "$action" = test || "$action" = build || "$action" = dry-build || "$action" = dry-activate ]]; then - if [[ -z $buildingAttribute ]]; then - pathToConfig="$(nixBuild $buildFile -A "${attr:+$attr.}config.system.build.toplevel" "${extraBuildFlags[@]}")" - elif [[ -z $flake ]]; then - pathToConfig="$(nixBuild '' -A system -k "${extraBuildFlags[@]}")" - else - pathToConfig="$(nixFlakeBuild "$flake#$flakeAttr.config.system.build.toplevel" "${extraBuildFlags[@]}" "${lockFlags[@]}")" - fi - elif [ "$action" = build-vm ]; then - if [[ -z $buildingAttribute ]]; then - pathToConfig="$(nixBuild $buildFile -A "${attr:+$attr.}config.system.build.vm" "${extraBuildFlags[@]}")" - elif [[ -z $flake ]]; then - pathToConfig="$(nixBuild '' -A vm -k "${extraBuildFlags[@]}")" - else - pathToConfig="$(nixFlakeBuild "$flake#$flakeAttr.config.system.build.vm" "${extraBuildFlags[@]}" "${lockFlags[@]}")" - fi - elif [ "$action" = build-vm-with-bootloader ]; then - if [[ -z $buildingAttribute ]]; then - pathToConfig="$(nixBuild $buildFile -A "${attr:+$attr.}config.system.build.vmWithBootLoader" "${extraBuildFlags[@]}")" - elif [[ -z $flake ]]; then - pathToConfig="$(nixBuild '' -A vmWithBootLoader -k "${extraBuildFlags[@]}")" - else - pathToConfig="$(nixFlakeBuild "$flake#$flakeAttr.config.system.build.vmWithBootLoader" "${extraBuildFlags[@]}" "${lockFlags[@]}")" - fi - else - showSyntax - fi - # Copy build to target host if we haven't already done it - if ! [[ "$action" = switch || "$action" = boot ]]; then - copyToTarget "$pathToConfig" - fi -else # [ -n "$rollback" ] - if [[ "$action" = switch || "$action" = boot ]]; then - targetHostSudoCmd nix-env --rollback -p "$profile" - pathToConfig="$profile" - elif [[ "$action" = test || "$action" = build ]]; then - systemNumber=$( - targetHostCmd nix-env -p "$profile" --list-generations | - sed -n '/current/ {g; p;}; s/ *\([0-9]*\).*/\1/; h' - ) - pathToConfig="$profile"-${systemNumber}-link - if [ -z "$targetHost" ]; then - ln -sT "$pathToConfig" ./result - fi - else - showSyntax - fi -fi - - -# If we're not just building, then make the new configuration the boot -# default and/or activate it now. -if [[ "$action" = switch || "$action" = boot || "$action" = test || "$action" = dry-activate ]]; then - # Using systemd-run here to protect against PTY failures/network - # disconnections during rebuild. - # See: https://github.com/NixOS/nixpkgs/issues/39118 - cmd=( - "systemd-run" - "-E" "LOCALE_ARCHIVE" # Will be set to new value early in switch-to-configuration script, but interpreter starts out with old value - "-E" "NIXOS_INSTALL_BOOTLOADER=$installBootloader" - "--collect" - "--no-ask-password" - "--pipe" - "--quiet" - "--same-dir" - "--service-type=exec" - "--unit=nixos-rebuild-switch-to-configuration" - "--wait" - ) - # Check if we have a working systemd-run. In chroot environments we may have - # a non-working systemd, so we fallback to not using systemd-run. - # You may also want to explicitly set NIXOS_SWITCH_USE_DIRTY_ENV environment - # variable, since systemd-run runs inside an isolated environment and - # this may break some post-switch scripts. However keep in mind that this - # may be dangerous in remote access (e.g. SSH). - if [[ -n "$NIXOS_SWITCH_USE_DIRTY_ENV" ]]; then - log "warning: skipping systemd-run since NIXOS_SWITCH_USE_DIRTY_ENV is set. This environment variable will be ignored in the future" - cmd=("env" "NIXOS_INSTALL_BOOTLOADER=$installBootloader") - elif ! targetHostSudoCmd "${cmd[@]}" true; then - logVerbose "Skipping systemd-run to switch configuration since it is not working in target host." - cmd=( - "env" - "-i" - "LOCALE_ARCHIVE=$LOCALE_ARCHIVE" - "NIXOS_INSTALL_BOOTLOADER=$installBootloader" - ) - else - logVerbose "Using systemd-run to switch configuration." - fi - if [[ -z "$specialisation" ]]; then - cmd+=("$pathToConfig/bin/switch-to-configuration") - else - cmd+=("$pathToConfig/specialisation/$specialisation/bin/switch-to-configuration") - - if [ -z "$targetHost" ]; then - specialisationExists=$(test -f "${cmd[-1]}") - else - specialisationExists=$(targetHostCmd test -f "${cmd[-1]}") - fi - - if ! $specialisationExists; then - log "error: specialisation not found: $specialisation" - exit 1 - fi - fi - - if ! targetHostSudoCmd "${cmd[@]}" "$action"; then - log "warning: error(s) occurred while switching to the new configuration" - exit 1 - fi -fi - - -if [[ "$action" = build-vm || "$action" = build-vm-with-bootloader ]]; then - cat >&2 <> ~/configuration.nix < ~/hardware-configuration.nix - - - echo Test traditional NixOS configuration - ######################################### - - expect ${writeText "test-nixos-rebuild-repl-expect" '' - ${expectSetup} - spawn nixos-rebuild repl --fast - - expect "nix-repl> " - - send "config.networking.hostName\n" - expect "\"nixos\"" - ''} - - - echo Test flake based NixOS configuration - ######################################### - - # Switch to flake flavored environment - unset NIX_PATH - cat > $NIX_CONF_DIR/nix.conf < ~/hardware-configuration.nix - - cat >~/flake.nix <" - - send "config.networking.hostName\n" - expect_simple "itsme" - - expect_simple "nix-repl>" - send "lib.version\n" - expect_simple ${escapeExpect ( - # The version string is a bit different in the flake lib, so we expect a prefix and ignore the rest - # Furthermore, including the revision (suffix) would cause unnecessary rebuilds. - # Note that a length of 4 only matches e.g. "24. - lib.strings.substring 0 4 (lib.strings.escapeNixString lib.version))} - - # Make sure it's the right lib - should be the flake lib, not Nixpkgs lib. - expect_simple "nix-repl>" - send "lib?nixosSystem\n" - expect_simple "true" - expect_simple "nix-repl>" - send "lib?nixos\n" - expect_simple "true" - ''} - - pushd "$HOME" - expect ${writeText "test-nixos-rebuild-repl-relative-path-expect" '' - ${expectSetup} - spawn sh -c "nixos-rebuild repl --fast --flake .#testconf" - - expect_simple "nix-repl>" - - send "config.networking.hostName\n" - expect_simple "itsme" - ''} - popd - - echo - - ######### - echo Done - touch $out -'' diff --git a/pkgs/overlays/selfExpr.nix b/pkgs/overlays/selfExpr.nix index 4dd0312..9b80b9f 100644 --- a/pkgs/overlays/selfExpr.nix +++ b/pkgs/overlays/selfExpr.nix @@ -7,7 +7,10 @@ in self: super: { selfExpr = let config = builtins.removeAttrs self.config [ "_undeclared" ]; - configJson = builtins.toJSON config; + configJson = self.lib.pipe config [ + (self.lib.filterAttrsRecursive (_: v: !self.lib.isFunction v)) + builtins.toJSON + ]; getSelfExpr = { useConfig ? true, From 1ef3c132ba7dda87994f647f25331e33c43c6730 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 2 Dec 2024 02:05:36 +0100 Subject: [PATCH 097/218] lock: update cosmic-modules --- lock.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lock.nix b/lock.nix index 81ac456..6ab104a 100644 --- a/lock.nix +++ b/lock.nix @@ -8,7 +8,7 @@ sha256 = "0zpvadqbs19jblnd0j2rfs9m7j0n5spx0vilq8907g2gqrx63fqp"; }; cosmic-modules = { - revision = "7dc8180bce46f1ed1446371369faf237e3a3eb15"; - sha256 = "13v4k0qx1c9j2fgz05prvq81s73v4gjk113dchl9pci0xcy3n698"; + revision = "e468c8b79dd55f1ce8803887d3593fb0016f1f81"; + sha256 = "0dhna0amd9pddac6mbx9wziq5mnwsjanda0wsn55ffmiq6cs92n2"; }; } From 934411dbcff22b4ed898acb040d0aa4c9b05ff14 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 2 Dec 2024 02:27:00 +0100 Subject: [PATCH 098/218] shell.nix: use ripdrag from stable --- nix-os/shell.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix-os/shell.nix b/nix-os/shell.nix index bdbd0c8..a48dcd8 100644 --- a/nix-os/shell.nix +++ b/nix-os/shell.nix @@ -18,7 +18,7 @@ let ] ++ old.propagatedBuildInputs; }); aliasDrag = pkgs.writeScriptBin "drag" '' - ${unstablePkgs.ripdrag}/bin/ripdrag -Axd $@ + ${pkgs.ripdrag}/bin/ripdrag -Axd $@ ''; in { @@ -65,7 +65,7 @@ in set vcs_aware true set show_hidden true - alias drag shell ${unstablePkgs.ripdrag}/bin/ripdrag -Axd %p & + alias drag shell ${pkgs.ripdrag}/bin/ripdrag -Axd %p & map drag ''; From 27c4a0ad87465bad63fc57c159334c821196b4b9 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 2 Dec 2024 05:41:25 +0100 Subject: [PATCH 099/218] nixos/nvidia: add patch for 6.12 kernel --- nix-os/nvidia.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nix-os/nvidia.nix b/nix-os/nvidia.nix index 7fe36eb..7ade093 100644 --- a/nix-os/nvidia.nix +++ b/nix-os/nvidia.nix @@ -22,6 +22,14 @@ openSha256 = "sha256-/tM3n9huz1MTE6KKtTCBglBMBGGL/GOHi5ZSUag4zXA="; settingsSha256 = "sha256-H7uEe34LdmUFcMcS6bz7sbpYhg9zPCb/5AmZZFTx1QA="; persistencedSha256 = "sha256-hdszsACWNqkCh8G4VBNitDT85gk9gJe1BlQ8LdrYIkg="; + patches = [ + (pkgs.fetchpatch { + # Kernel 6.12 compatibility + # https://forums.developer.nvidia.com/t/patch-for-565-57-01-linux-kernel-6-12/313260 + url = "https://github.com/Binary-Eater/open-gpu-kernel-modules/commit/8ac26d3c66ea88b0f80504bdd1e907658b41609d.patch"; + hash = "sha256-+SfIu3uYNQCf/KXhv4PWvruTVKQSh4bgU1moePhe57U="; + }) + ]; }; }; nixpkgs.config.nvidia.acceptLicense = true; From 841e642e7f5f64de386a99bbf526425147ee5f5e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 2 Dec 2024 05:51:25 +0100 Subject: [PATCH 100/218] nixos/core: use 6.11 kernel --- nix-os/core.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index 1b4bb40..2eeee05 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -29,7 +29,8 @@ in ]; # kernel - boot.kernelPackages = pkgs.linuxPackages_latest; + # FIXME: current cosmic-greeter (2024-12-02) fails to start with kernel 6.12 + boot.kernelPackages = pkgs.linuxPackages_6_11; # Enable networking networking.networkmanager.enable = true; From 74f18f57669cef939b33e7345423b0e997ab4dfd Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 2 Dec 2024 06:36:46 +0100 Subject: [PATCH 101/218] nixos/core: fix nix paths unavailable in nix --- nix-os/core.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index 2eeee05..d255b09 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -43,7 +43,7 @@ in settings.experimental-features = [ "no-url-literals" ]; - settings.nix-path = [ + nixPath = [ "nixpkgs=${pkgs.selfExpr { useConfig = false; }}" "systemNixpkgs=${pkgs.selfExpr { useConfig = true; name = "systemNixpkgs-self"; }}" # don't garbage collect the nixpkgs input From cdd512102633f756548f5f11d8f20307d47b2997 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 3 Dec 2024 09:06:23 +0100 Subject: [PATCH 102/218] nixos/core: replace x11 forwarding with waypipe waypipe is provided through core module because maybe I'll want to use it on servers without desktop who knows --- nix-os/core-desktop.nix | 4 ---- nix-os/core.nix | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix index fe44a32..f1875ed 100644 --- a/nix-os/core-desktop.nix +++ b/nix-os/core-desktop.nix @@ -96,10 +96,6 @@ }; }; - services.openssh.extraConfig = '' - X11Forwarding yes - ''; - # Fonts fonts.packages = with pkgs; [ corefonts diff --git a/nix-os/core.nix b/nix-os/core.nix index d255b09..4bded0c 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -54,6 +54,7 @@ in # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ + waypipe wget ffmpeg yt-dlp From 7a5bb321ef268e33844b093886aabbde15e86803 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 3 Dec 2024 20:45:01 +0100 Subject: [PATCH 103/218] nixos: replace pavucontrol with pwvucontrol --- nix-os/core-desktop.nix | 1 + nix-os/dconf-common.nix | 2 +- .../cosmic-config/com.system76.CosmicAppList/v1/favorites | 2 +- nix-os/desktopManagers/cosmic.nix | 1 - nix-os/desktopManagers/gnome.nix | 1 - 5 files changed, 3 insertions(+), 4 deletions(-) diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix index f1875ed..613b3f0 100644 --- a/nix-os/core-desktop.nix +++ b/nix-os/core-desktop.nix @@ -23,6 +23,7 @@ environment.systemPackages = with pkgs; [ kdePackages.kdeconnect-kde pcmanfm + pwvucontrol qimgv ]; diff --git a/nix-os/dconf-common.nix b/nix-os/dconf-common.nix index 0f8c1e4..bb88fcc 100644 --- a/nix-os/dconf-common.nix +++ b/nix-os/dconf-common.nix @@ -69,7 +69,7 @@ "code.desktop" "org.gnome.Nautilus.desktop" "steam.desktop" - "pavucontrol.desktop" + "com.saivert.pwvucontrol.desktop" ]; }; diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/favorites b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/favorites index 088deb1..d926828 100644 --- a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/favorites +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicAppList/v1/favorites @@ -7,5 +7,5 @@ "vesktop", "org.telegram.desktop", "jitsi-meet-electron", - "pavucontrol", + "com.saivert.pwvucontrol", ] diff --git a/nix-os/desktopManagers/cosmic.nix b/nix-os/desktopManagers/cosmic.nix index 01e6b5d..bdd784d 100644 --- a/nix-os/desktopManagers/cosmic.nix +++ b/nix-os/desktopManagers/cosmic.nix @@ -28,7 +28,6 @@ in cosmic-term ]; environment.systemPackages = with pkgs; [ - pavucontrol (lib.hiPrio cosmic-configuration.share) ]; services.gnome.gnome-keyring.enable = true; diff --git a/nix-os/desktopManagers/gnome.nix b/nix-os/desktopManagers/gnome.nix index f13c706..c1d691c 100644 --- a/nix-os/desktopManagers/gnome.nix +++ b/nix-os/desktopManagers/gnome.nix @@ -80,7 +80,6 @@ in gnomeExtensions.top-bar-organizer # unstablePkgs.gnomeExtensions.translate-indicator # translate-shell - pavucontrol google-cursor ]; From e029864fa57fde8223727aa145302282743e0fdf Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 5 Dec 2024 00:06:08 +0100 Subject: [PATCH 104/218] nixos/core-desktop: disable device profile autoswitching I have no idea why configuration under "bluetooth" affect device that is connected throug usb. genius. --- nix-os/core-desktop.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix index 613b3f0..732a781 100644 --- a/nix-os/core-desktop.nix +++ b/nix-os/core-desktop.nix @@ -18,6 +18,9 @@ # Enable audio interfaces renaming wireplumber.enable = true; + wireplumber.extraConfig = { + "dont-switch-device-profiles"."wireplumber.settings"."bluetooth.autoswitch-to-headset-profile" = false; + }; }; environment.systemPackages = with pkgs; [ From 719c2f7b0232dcc93b0fcb803c78e54bbae794a3 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 7 Dec 2024 12:57:22 +0100 Subject: [PATCH 105/218] hosts/main: disable xrdp --- hosts/main/default.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/hosts/main/default.nix b/hosts/main/default.nix index 9d3966f..006239a 100644 --- a/hosts/main/default.nix +++ b/hosts/main/default.nix @@ -33,9 +33,6 @@ networking.hostName = "wroclaw-main"; - services.xrdp.enable = true; - users.groups."tsusers".members = [ "wroclaw" ]; - services.printing.drivers = with pkgs; [ hplip ]; From 95393d34148c44dd09c3efe0d2b3af09fb8c3eea Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 7 Dec 2024 13:05:27 +0100 Subject: [PATCH 106/218] lock: update --- lock.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lock.nix b/lock.nix index 6ab104a..2cedd21 100644 --- a/lock.nix +++ b/lock.nix @@ -4,11 +4,11 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "62c435d93bf046a5396f3016472e8f7c8e2aed65"; - sha256 = "0zpvadqbs19jblnd0j2rfs9m7j0n5spx0vilq8907g2gqrx63fqp"; + revision = "4dc2fc4e62dbf62b84132fe526356fbac7b03541"; + sha256 = "10sm236ix9v0qaih2pvfdzw8vjg1w4z11fjkkrzknn4x98gnaa8n"; }; cosmic-modules = { - revision = "e468c8b79dd55f1ce8803887d3593fb0016f1f81"; - sha256 = "0dhna0amd9pddac6mbx9wziq5mnwsjanda0wsn55ffmiq6cs92n2"; + revision = "313f9b0d8cb2ec8bec0f4d5170c3fda41d49f58c"; + sha256 = "1aqw71bc79mkgikbjx519m1z81ikwdahnshfrzjcrafclalgj5pp"; }; } From 985c82fa2b810a7058c0d60f098d0ea28a5439bf Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 7 Dec 2024 13:16:22 +0100 Subject: [PATCH 107/218] lock: fix wrong revision in cosmic-modules --- lock.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lock.nix b/lock.nix index 2cedd21..59d2cc4 100644 --- a/lock.nix +++ b/lock.nix @@ -8,7 +8,7 @@ sha256 = "10sm236ix9v0qaih2pvfdzw8vjg1w4z11fjkkrzknn4x98gnaa8n"; }; cosmic-modules = { - revision = "313f9b0d8cb2ec8bec0f4d5170c3fda41d49f58c"; + revision = "25aa22b5972d27a6b432ccd6f9e2f42b1b7b71ca"; sha256 = "1aqw71bc79mkgikbjx519m1z81ikwdahnshfrzjcrafclalgj5pp"; }; } From bad4bbcb64c973128e31335af2443f33be9817f8 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 7 Dec 2024 14:24:24 +0100 Subject: [PATCH 108/218] nixos/shell.nix: update nvim colorscheme --- nix-os/shell.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nix-os/shell.nix b/nix-os/shell.nix index a48dcd8..e4a79d2 100644 --- a/nix-os/shell.nix +++ b/nix-os/shell.nix @@ -93,6 +93,7 @@ in set expandtab set autoindent set updatetime=500 + colorscheme vim syntax on set encoding=utf-8 @@ -109,10 +110,10 @@ in " vim-gitguter set signcolumn=yes - highlight SignColumn ctermbg=NONE - highlight GitGutterAdd ctermfg=2 - highlight GitGutterChange ctermfg=4 - highlight GitGutterDelete ctermfg=1 + highlight SignColumn NONE + highlight GitGutterAdd ctermfg=2 guifg=#2ea043 + highlight GitGutterChange ctermfg=4 guifg=#0078d4 + highlight GitGutterDelete ctermfg=1 guifg=#f85149 lua require('guess-indent').setup {} ''; From de3e8a3340240a8e398196c027eafc69dc80c6cf Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 15 Dec 2024 05:22:37 +0100 Subject: [PATCH 109/218] hosts/main: enable ollama --- hosts/main/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hosts/main/default.nix b/hosts/main/default.nix index 006239a..f6aee98 100644 --- a/hosts/main/default.nix +++ b/hosts/main/default.nix @@ -71,6 +71,13 @@ hardware.i2c.enable = true; services.hardware.openrgb.enable = true; + services.ollama = { + enable = true; + port = 1434; + acceleration = "cuda"; + host = "0.0.0.0"; + }; + system.stateVersion = "23.05"; }; } From 4968fc8b5e6c5f64870b4ac6440e8a25c60d6b2f Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 15 Dec 2024 06:41:08 +0100 Subject: [PATCH 110/218] hosts/main: expose ollama server in environment variable --- hosts/main/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hosts/main/default.nix b/hosts/main/default.nix index f6aee98..35d3053 100644 --- a/hosts/main/default.nix +++ b/hosts/main/default.nix @@ -1,5 +1,6 @@ { inputs, + config, pkgs, self, ... @@ -77,6 +78,9 @@ acceleration = "cuda"; host = "0.0.0.0"; }; + environment.sessionVariables = { + OLLAMA_HOST = "127.0.0.1:${builtins.toString config.services.ollama.port}"; + }; system.stateVersion = "23.05"; }; From fffbd4a181652f0f8b393ca36ff0883fe47003cd Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 15 Dec 2024 08:27:30 +0100 Subject: [PATCH 111/218] hosts/main: use ollama from unstable --- hosts/main/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts/main/default.nix b/hosts/main/default.nix index 35d3053..75d7df7 100644 --- a/hosts/main/default.nix +++ b/hosts/main/default.nix @@ -76,6 +76,7 @@ enable = true; port = 1434; acceleration = "cuda"; + package = pkgs.unstable.ollama; host = "0.0.0.0"; }; environment.sessionVariables = { From c6abe0f8d63f9fb01243e7d3912a0800919ac7b8 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 22 Dec 2024 12:12:45 +0100 Subject: [PATCH 112/218] lock: update --- lock.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lock.nix b/lock.nix index 59d2cc4..d60d746 100644 --- a/lock.nix +++ b/lock.nix @@ -4,11 +4,11 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "4dc2fc4e62dbf62b84132fe526356fbac7b03541"; - sha256 = "10sm236ix9v0qaih2pvfdzw8vjg1w4z11fjkkrzknn4x98gnaa8n"; + revision = "1c6e20d41d6a9c1d737945962160e8571df55daa"; + sha256 = "1cyck9dycldzj5p8p2bz0rhzmdgm75zvmg9afhblm4k9vlr350qq"; }; cosmic-modules = { - revision = "25aa22b5972d27a6b432ccd6f9e2f42b1b7b71ca"; - sha256 = "1aqw71bc79mkgikbjx519m1z81ikwdahnshfrzjcrafclalgj5pp"; + revision = "86e08fbc79f33f98c00097d6dcabe0e17c20faae"; + sha256 = "1zxv3lx813wvy4d036w5lg34qf51idcbd49fnllfy7vxz2nhbdp1"; }; } From 492255e4e0f753a01bbdd514f4c2e99814a995f2 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 22 Dec 2024 16:37:52 +0100 Subject: [PATCH 113/218] nixos/nvidia: update driver --- nix-os/core.nix | 3 +-- nix-os/nvidia.nix | 20 ++++++-------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index 4bded0c..4252607 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -29,8 +29,7 @@ in ]; # kernel - # FIXME: current cosmic-greeter (2024-12-02) fails to start with kernel 6.12 - boot.kernelPackages = pkgs.linuxPackages_6_11; + boot.kernelPackages = pkgs.linuxPackages_latest; # Enable networking networking.networkmanager.enable = true; diff --git a/nix-os/nvidia.nix b/nix-os/nvidia.nix index 7ade093..1d4a068 100644 --- a/nix-os/nvidia.nix +++ b/nix-os/nvidia.nix @@ -16,20 +16,12 @@ open = false; nvidiaSettings = true; package = config.boot.kernelPackages.nvidiaPackages.mkDriver { - version = "565.57.01"; - sha256_64bit = "sha256-buvpTlheOF6IBPWnQVLfQUiHv4GcwhvZW3Ks0PsYLHo="; - sha256_aarch64 = "sha256-aDVc3sNTG4O3y+vKW87mw+i9AqXCY29GVqEIUlsvYfE="; - openSha256 = "sha256-/tM3n9huz1MTE6KKtTCBglBMBGGL/GOHi5ZSUag4zXA="; - settingsSha256 = "sha256-H7uEe34LdmUFcMcS6bz7sbpYhg9zPCb/5AmZZFTx1QA="; - persistencedSha256 = "sha256-hdszsACWNqkCh8G4VBNitDT85gk9gJe1BlQ8LdrYIkg="; - patches = [ - (pkgs.fetchpatch { - # Kernel 6.12 compatibility - # https://forums.developer.nvidia.com/t/patch-for-565-57-01-linux-kernel-6-12/313260 - url = "https://github.com/Binary-Eater/open-gpu-kernel-modules/commit/8ac26d3c66ea88b0f80504bdd1e907658b41609d.patch"; - hash = "sha256-+SfIu3uYNQCf/KXhv4PWvruTVKQSh4bgU1moePhe57U="; - }) - ]; + version = "565.77"; + sha256_64bit = "sha256-CnqnQsRrzzTXZpgkAtF7PbH9s7wbiTRNcM0SPByzFHw="; + sha256_aarch64 = "sha256-LSAYUnhfnK3rcuPe1dixOwAujSof19kNOfdRHE7bToE="; + openSha256 = "sha256-Fxo0t61KQDs71YA8u7arY+503wkAc1foaa51vi2Pl5I="; + settingsSha256 = "sha256-VUetj3LlOSz/LB+DDfMCN34uA4bNTTpjDrb6C6Iwukk="; + persistencedSha256 = "sha256-wnDjC099D8d9NJSp9D0CbsL+vfHXyJFYYgU3CwcqKww="; }; }; nixpkgs.config.nvidia.acceptLicense = true; From 0af88c8ae70e77e01c1427d43fa6ed95e57b7232 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 3 Jan 2025 02:26:43 +0100 Subject: [PATCH 114/218] pkgs/overlays/unstable-from-source: remove darwin{Sdk; Min}Version from platform --- pkgs/overlays/unstable-from-source.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/overlays/unstable-from-source.nix b/pkgs/overlays/unstable-from-source.nix index afb8f2e..214307d 100644 --- a/pkgs/overlays/unstable-from-source.nix +++ b/pkgs/overlays/unstable-from-source.nix @@ -9,6 +9,8 @@ let sanitizePlatform = platformConfig: self.lib.removeAttrs platformConfig [ "emulator" "emulatorAvailable" + "darwinSdkVersion" + "darwinMinVersion" ]; unstablePkgsForNixpkgs = nixpkgs: import unstableSource { From 2d24ce7fd467763b2ad2663076bb2ca433df1522 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 3 Jan 2025 02:27:59 +0100 Subject: [PATCH 115/218] pkgs/overlays/cosmic-packages: use unstable-from-source overlay code here wants to do the same thing as unstable-from-source overlay --- pkgs/overlays/cosmic-packages.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkgs/overlays/cosmic-packages.nix b/pkgs/overlays/cosmic-packages.nix index 9b9f6f5..5f34ffa 100644 --- a/pkgs/overlays/cosmic-packages.nix +++ b/pkgs/overlays/cosmic-packages.nix @@ -20,12 +20,11 @@ let }; # Initialize pinned nixpkgs - futureNixpkgs = import futureNixpkgsSrc { - localSystem = self.stdenv.buildPlatform; - config = self.config; - } // (if self.stdenv.buildPlatform == self.stdenv.hostPlatform then {} else { - crossSystem = self.stdenv.hostPlatform; - }); + futureNixpkgs = let + extended = self.extend (import ./unstable-from-source.nix { + unstableSource = futureNixpkgsSrc; + }); + in extended.unstable; in import "${nixos-cosmic}/pkgs" { From 04af4df022401dfcd27627a2c7d7f5d9046693df Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 3 Jan 2025 03:52:30 +0100 Subject: [PATCH 116/218] lock: update --- lock.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lock.nix b/lock.nix index d60d746..efc9fc8 100644 --- a/lock.nix +++ b/lock.nix @@ -4,11 +4,11 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "1c6e20d41d6a9c1d737945962160e8571df55daa"; - sha256 = "1cyck9dycldzj5p8p2bz0rhzmdgm75zvmg9afhblm4k9vlr350qq"; + revision = "edf04b75c13c2ac0e54df5ec5c543e300f76f1c9"; + sha256 = "0zffg0m7rhdpk94df578wln5lw3plamadac86cd7cfjcb1n13xmm"; }; cosmic-modules = { - revision = "86e08fbc79f33f98c00097d6dcabe0e17c20faae"; - sha256 = "1zxv3lx813wvy4d036w5lg34qf51idcbd49fnllfy7vxz2nhbdp1"; + revision = "c9667d79481c62d9b204f8cb13d043b9b1f5dc05"; + sha256 = "1q07p4zicp1bjxwn3n6w48045kd5dabkffzwxydjgjfgrsdkz1f0"; }; } From a231968592b37bbd9fe5d5da4a7c3e47f059e97e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 3 Jan 2025 23:06:20 +0100 Subject: [PATCH 117/218] nixos/cosmic: update config defaults --- .../com.system76.CosmicComp/v1/focus_follows_cursor_delay | 2 +- .../com.system76.CosmicPanel.Panel/v1/plugins_wings | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/focus_follows_cursor_delay b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/focus_follows_cursor_delay index 8a32cf7..e373ee6 100644 --- a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/focus_follows_cursor_delay +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicComp/v1/focus_follows_cursor_delay @@ -1 +1 @@ -250 \ No newline at end of file +50 diff --git a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/plugins_wings b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/plugins_wings index 3d44247..88477bc 100644 --- a/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/plugins_wings +++ b/nix-os/desktopManagers/cosmic-config/com.system76.CosmicPanel.Panel/v1/plugins_wings @@ -2,8 +2,8 @@ Some(([ "com.system76.CosmicPanelAppButton", "com.system76.CosmicAppletWorkspaces", ], [ - "com.system76.CosmicAppletInputSources", "com.system76.CosmicAppletStatusArea", + "com.system76.CosmicAppletInputSources", "com.system76.CosmicAppletTiling", "com.system76.CosmicAppletAudio", "com.system76.CosmicAppletNetwork", @@ -11,4 +11,4 @@ Some(([ "com.system76.CosmicAppletNotifications", "com.system76.CosmicAppletBluetooth", "com.system76.CosmicAppletPower", -])) \ No newline at end of file +])) From 5f061310763769fdebf6e3b1e9949a9fa033cfb7 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 3 Jan 2025 23:06:44 +0100 Subject: [PATCH 118/218] nixos/cosmic: set default cursor theme --- nix-os/desktopManagers/cosmic.nix | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/nix-os/desktopManagers/cosmic.nix b/nix-os/desktopManagers/cosmic.nix index bdd784d..1dfb638 100644 --- a/nix-os/desktopManagers/cosmic.nix +++ b/nix-os/desktopManagers/cosmic.nix @@ -1,4 +1,10 @@ -{ inputs, lib, pkgs, ... }: +{ + inputs, + lib, + pkgs, + self, + ... +}: let cosmic-configuration = pkgs.substituteAllFiles { @@ -20,6 +26,7 @@ in { imports = [ "${inputs.cosmic-modules}/nixos/cosmic/module.nix" + "${self}/nix-os/generic/dconf.nix" ]; config = { services.desktopManager.cosmic.enable = true; @@ -29,7 +36,26 @@ in ]; environment.systemPackages = with pkgs; [ (lib.hiPrio cosmic-configuration.share) + google-cursor ]; services.gnome.gnome-keyring.enable = true; + + proot.dconf = { + rules."org/gnome/desktop/interface".cursor-theme = "GoogleDot-White"; + profiles.user.rulesToApply = [ + "org/gnome/desktop/interface" + ]; + }; + + environment.sessionVariables = { + XCURSOR_SIZE = "16"; + XCURSOR_THEME = "GoogleDot-White"; + }; + + environment.etc."xdg/gtk-3.0/settings.ini".text = '' + [Settings] + gtk-cursor-theme-name=GoogleDot-White + gtk-application-prefer-dark-theme=true + ''; }; } From 1a30ebe4a0d5943a4c2c702b04691446c378734b Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 9 Jan 2025 17:45:57 +0100 Subject: [PATCH 119/218] nixos/core-desktop: fix mpv config warning --- nix-os/core-desktop.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix index 732a781..e8add68 100644 --- a/nix-os/core-desktop.nix +++ b/nix-os/core-desktop.nix @@ -60,8 +60,7 @@ keep-open = "yes"; volume = "40"; osd-fractions = "yes"; - background = "0.0/1.0"; - alpha = "yes"; + background = "none"; }; input = lib.mkMerge [ # mpv core From 78c9b9d29774f34c8f4d526ee981c2cfd8e20ba1 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 9 Jan 2025 17:48:34 +0100 Subject: [PATCH 120/218] nixos/core-desktop: use builtin decorations for mpv --- nix-os/core-desktop.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix index e8add68..0d40ca5 100644 --- a/nix-os/core-desktop.nix +++ b/nix-os/core-desktop.nix @@ -61,6 +61,7 @@ volume = "40"; osd-fractions = "yes"; background = "none"; + border = "no"; }; input = lib.mkMerge [ # mpv core From 75f5d7ee9dd4b452f42bf248a52cde0e0f4b1364 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 11 Jan 2025 12:12:55 +0100 Subject: [PATCH 121/218] lock: update --- lock.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lock.nix b/lock.nix index efc9fc8..100cf80 100644 --- a/lock.nix +++ b/lock.nix @@ -4,11 +4,11 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "edf04b75c13c2ac0e54df5ec5c543e300f76f1c9"; - sha256 = "0zffg0m7rhdpk94df578wln5lw3plamadac86cd7cfjcb1n13xmm"; + revision = "3f0a8ac25fb674611b98089ca3a5dd6480175751"; + sha256 = "10i7fllqjzq171afzhdf2d9r1pk9irvmq5n55h92rc47vlaabvr4"; }; cosmic-modules = { - revision = "c9667d79481c62d9b204f8cb13d043b9b1f5dc05"; - sha256 = "1q07p4zicp1bjxwn3n6w48045kd5dabkffzwxydjgjfgrsdkz1f0"; + revision = "a934c861065b6b1aca9a859c45631336e0e8560c"; + sha256 = "1p0hs2z1h9fl25qvrlprf63cj1v0m7hr2y051mykjvdxikvn5a47"; }; } From 77ef7434f24baa95c6929a9e532967b0e58b7294 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 12 Jan 2025 21:54:47 +0100 Subject: [PATCH 122/218] inputs: pin nixpkgs-unstable --- inputs.nix | 5 +++++ lock.nix | 4 ++++ nix-os/unstable-packages.nix | 10 ++++++++-- outputs.nix | 2 +- pkgs/overlays/unstable-with-meta.nix | 16 ++++++++++++++++ pkgs/overlays/unstable.nix | 24 ------------------------ pkgs/top-level/default.nix | 2 +- 7 files changed, 35 insertions(+), 28 deletions(-) create mode 100644 pkgs/overlays/unstable-with-meta.nix delete mode 100644 pkgs/overlays/unstable.nix diff --git a/inputs.nix b/inputs.nix index 334379b..1979433 100644 --- a/inputs.nix +++ b/inputs.nix @@ -15,6 +15,11 @@ let self = { url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs.revision}.tar.gz"; sha256 = "${lock.nixpkgs.sha256}"; }; + nixpkgs-unstable = builtins.fetchTarball { + name = "nixpkgs-unstable"; + url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs-unstable.revision}.tar.gz"; + sha256 = "${lock.nixpkgs-unstable.sha256}"; + }; cosmic-modules = builtins.fetchTarball { name = "cosmic-modules"; url = "https://github.com/lilyinstarlight/nixos-cosmic/archive/${lock.cosmic-modules.revision}.tar.gz"; diff --git a/lock.nix b/lock.nix index 100cf80..84cd166 100644 --- a/lock.nix +++ b/lock.nix @@ -7,6 +7,10 @@ revision = "3f0a8ac25fb674611b98089ca3a5dd6480175751"; sha256 = "10i7fllqjzq171afzhdf2d9r1pk9irvmq5n55h92rc47vlaabvr4"; }; + nixpkgs-unstable = { + revision = "130595eba61081acde9001f43de3248d8888ac4a"; + sha256 = "0sw7zg4gal3wpz51ch1v36pdan9z73d4f3yrggh8h2clxs8jdgsx"; + }; cosmic-modules = { revision = "a934c861065b6b1aca9a859c45631336e0e8560c"; sha256 = "1p0hs2z1h9fl25qvrlprf63cj1v0m7hr2y051mykjvdxikvn5a47"; diff --git a/nix-os/unstable-packages.nix b/nix-os/unstable-packages.nix index 4c41240..b39d9f4 100644 --- a/nix-os/unstable-packages.nix +++ b/nix-os/unstable-packages.nix @@ -1,8 +1,14 @@ -{config, pkgs, lib, ...}: +{ + config, + lib, + pkgs, + self, + ... +}: let cfg = config.unstable; - unstableOverlay = import ../pkgs/overlays/unstable.nix; + unstableOverlay = self.overlays.unstableWithMeta; in { options.unstable = { diff --git a/outputs.nix b/outputs.nix index 3355399..e1e2c24 100644 --- a/outputs.nix +++ b/outputs.nix @@ -15,7 +15,7 @@ self = { overlays = { cosmicPackages = import ./pkgs/overlays/cosmic-packages.nix { inherit inputs; }; selfExpr = import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = inputs.nixpkgs; }; - unstable = import ./pkgs/overlays/unstable.nix; + unstableWithMeta = import ./pkgs/overlays/unstable-with-meta.nix { unstableSource = inputs.nixpkgs-unstable; revision = inputs.lock.nixpkgs-unstable.revision; }; versionInfoFixup = import ./pkgs/overlays/version-info-fixup.nix { inherit inputs; }; }; nixosConfigurations = let diff --git a/pkgs/overlays/unstable-with-meta.nix b/pkgs/overlays/unstable-with-meta.nix new file mode 100644 index 0000000..dbfbc2c --- /dev/null +++ b/pkgs/overlays/unstable-with-meta.nix @@ -0,0 +1,16 @@ +{ + unstableSource, + revision, +}: self: super: + +let + version = builtins.readFile "${unstableSource}/lib/.version" + ".git." + builtins.substring 0 12 revision; + useUnstable = self.config.useUnstable or true; + +in +import ./unstable-from-source.nix { + inherit unstableSource; +} self super // { + unstableVersion = self.lib.optionalString useUnstable version; + unstableRevision = self.lib.optionalString useUnstable revision; +} diff --git a/pkgs/overlays/unstable.nix b/pkgs/overlays/unstable.nix deleted file mode 100644 index 73e79b9..0000000 --- a/pkgs/overlays/unstable.nix +++ /dev/null @@ -1,24 +0,0 @@ -self: super: - -let - nixos = self.config.nixos or true; - useUnstable = self.config.useUnstable or true; - - unstablePkgsExprs = if nixos - then builtins.fetchTarball "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz" - else builtins.fetchTarball "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; - - # Compiled nixpkgs expression eg expressions from a nix channel - nixpkgsVersion = builtins.concatStringsSep "." [ - (builtins.readFile "${unstablePkgsExprs}/.version") - (builtins.readFile "${unstablePkgsExprs}/.version-suffix") - ]; - - nixpkgsRevision = (builtins.readFile "${unstablePkgsExprs}/.git-revision"); -in -import ./unstable-from-source.nix { - unstableSource = unstablePkgsExprs; -} self super // { - unstableVersion = self.lib.optionalString useUnstable nixpkgsVersion; - unstableRevision = self.lib.optionalString useUnstable nixpkgsRevision; -} diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index fd3e12a..dfdae8b 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -14,7 +14,7 @@ let overlays = (args.overlays or []) ++ [ # ../.. should be nix store path that represents self in outputs.nix that is gc-rooted by this point ( import ../overlays/selfExpr.nix { nixpkgsPath = "${builtins.toString ../..}/pkgs/top-level/impure.nix"; } ) - ( import ../overlays/unstable.nix ) + ( import ../overlays/unstable-with-meta.nix { unstableSource = inputs.nixpkgs-unstable; revision = inputs.lock.nixpkgs-unstable.revision; } ) ( import ../overlays/version-info-fixup.nix { inherit inputs; } ) ( import ./by-name-overlay.nix ../by-name ) ]; From bb3c2721194a123a8e240fb94874653097b0f2b8 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 12 Jan 2025 22:19:00 +0100 Subject: [PATCH 123/218] pkgs/overlays/version-info-fixup: support unstable-with-meta overlay --- lib/overlays/version-info-fixup.nix | 6 +++--- outputs.nix | 2 +- pkgs/overlays/version-info-fixup.nix | 9 ++++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/overlays/version-info-fixup.nix b/lib/overlays/version-info-fixup.nix index b413842..104840a 100644 --- a/lib/overlays/version-info-fixup.nix +++ b/lib/overlays/version-info-fixup.nix @@ -1,8 +1,8 @@ -{ inputs ? import ../../inputs.nix {} }: +{ revision }: selfLib: superLib: { trivial = superLib.trivial // { - versionSuffix = ".git.${builtins.substring 0 12 inputs.lock.nixpkgs.revision}"; - revisionWithDefault = default: inputs.lock.nixpkgs.revision or default; + versionSuffix = ".git.${builtins.substring 0 12 revision}"; + revisionWithDefault = default: revision; }; } diff --git a/outputs.nix b/outputs.nix index e1e2c24..225823d 100644 --- a/outputs.nix +++ b/outputs.nix @@ -5,7 +5,7 @@ let -lib = (import "${inputs.nixpkgs}/lib").extend (import ./lib/overlays/version-info-fixup.nix { inherit inputs; }); +lib = (import "${inputs.nixpkgs}/lib").extend (import ./lib/overlays/version-info-fixup.nix { revision = inputs.lock.nixpkgs.revision; }); self = { inherit inputs lib self; diff --git a/pkgs/overlays/version-info-fixup.nix b/pkgs/overlays/version-info-fixup.nix index 14d890e..b1f2ecc 100644 --- a/pkgs/overlays/version-info-fixup.nix +++ b/pkgs/overlays/version-info-fixup.nix @@ -1,5 +1,12 @@ { inputs ? import ../../inputs.nix {} }: self: super: { - lib = super.lib.extend (import ../../lib/overlays/version-info-fixup.nix { inherit inputs; }); + lib = super.lib.extend (import ../../lib/overlays/version-info-fixup.nix { revision = inputs.lock.nixpkgs.revision; }); +} // +super.lib.optionalAttrs (super ? unstable && super ? unstableRevision) { + unstable = super.unstable // { + lib = super.unstable.lib.extend (import ../../lib/overlays/version-info-fixup.nix { + revision = super.unstableRevision; + }); + }; } From 33708ea92233f0c814898866f4f358d9863b5aa8 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 12 Jan 2025 23:00:44 +0100 Subject: [PATCH 124/218] output: remove unnecesary store copy for hosts directory --- outputs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.nix b/outputs.nix index 225823d..dd3f3ca 100644 --- a/outputs.nix +++ b/outputs.nix @@ -26,7 +26,7 @@ self = { ( # regular .nix files (type == "regular" && lib.hasSuffix ".nix" name) || # directories that contain a default.nix file - (type == "directory" && builtins.pathExists "${./hosts}/${name}/default.nix") + (type == "directory" && builtins.pathExists "${./.}/hosts/${name}/default.nix") ) # filter out files that start with . && !lib.hasPrefix "." name From 3e37f1fbd4dc0672bb00a410b3db8ea8c3814e89 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 13 Jan 2025 00:46:20 +0100 Subject: [PATCH 125/218] default.nix: use nixpkgs lib --- default.nix | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/default.nix b/default.nix index 0c9248a..35a779a 100644 --- a/default.nix +++ b/default.nix @@ -3,16 +3,8 @@ # if evaluating inside the store, import the outputs.nix file let - contains = str: substr: let - str_length = builtins.stringLength str; - substr_length = builtins.stringLength substr; - listOfPossibleSubstrings = builtins.genList (i: builtins.substring i substr_length str) (str_length - substr_length + 1); - in if substr_length > str_length then false else builtins.any (x: x == substr) listOfPossibleSubstrings; - - endsWith = str: substr: let - str_length = builtins.stringLength str; - substr_length = builtins.stringLength substr; - in if substr_length > str_length then false else builtins.substring (str_length - substr_length) str_length str == substr; + # Ideally this file should not depend on nixpkgs lib itself, but I like the utilities here + lib = (import "${(import ./inputs.nix {}).nixpkgs}/lib"); gitignore = builtins.filter (v: # ignore comments and empty lines @@ -32,11 +24,11 @@ let if pattern == "*" then true else if pattern == ".*" then true else if pattern == "*.*" then true - else if builtins.substring 0 2 pattern == "*." then endsWith path (builtins.substring 0 2 pattern) - else if contains pattern "*" then abort unsupportedPatternMessage + else if builtins.substring 0 2 pattern == "*." then lib.hasSuffix (builtins.substring 0 2 pattern) path + else if lib.hasInfix "*" pattern then abort unsupportedPatternMessage else if patternLength > 2 && builtins.substring 0 2 pattern == "./" then abort unsupportedPatternMessage else if patternLength > 1 && builtins.substring 0 1 pattern == "/" then abort unsupportedPatternMessage - else contains path pattern + else lib.hasInfix pattern path ) gitignore; currentFilePath = (builtins.unsafeGetAttrPos "any" { any = "any"; }).file; From b73cea4b07375cb05b1acfc960b2957a8367d985 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 19 Jan 2025 11:20:08 +0100 Subject: [PATCH 126/218] lock: update --- lock.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lock.nix b/lock.nix index 84cd166..e643ce3 100644 --- a/lock.nix +++ b/lock.nix @@ -4,15 +4,15 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "3f0a8ac25fb674611b98089ca3a5dd6480175751"; - sha256 = "10i7fllqjzq171afzhdf2d9r1pk9irvmq5n55h92rc47vlaabvr4"; + revision = "6a3ae7a5a12fb8cac2d59d7df7cbd95f9b2f0566"; + sha256 = "0srx4jvdqw14xmi0gsghynpki9fpadshnvsjzz4zv55fyf9hm3dk"; }; nixpkgs-unstable = { - revision = "130595eba61081acde9001f43de3248d8888ac4a"; - sha256 = "0sw7zg4gal3wpz51ch1v36pdan9z73d4f3yrggh8h2clxs8jdgsx"; + revision = "5df43628fdf08d642be8ba5b3625a6c70731c19c"; + sha256 = "05xhbk4yjbv0f760ld6q9z2v0nphakgk78kgd0wnnmzdjqqkbfad"; }; cosmic-modules = { - revision = "a934c861065b6b1aca9a859c45631336e0e8560c"; - sha256 = "1p0hs2z1h9fl25qvrlprf63cj1v0m7hr2y051mykjvdxikvn5a47"; + revision = "6ec08f11bbf0e936ad82f1bb532f3757f8b5e3c2"; + sha256 = "055dwpmbp2q6xnrk1gdrql4w5w4cxb82d8ar7ma5z2kz0sfjf1yi"; }; } From b715a9c200e658f48748f843671b3bb844c7de52 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 19 Jan 2025 18:16:04 +0100 Subject: [PATCH 127/218] default.nix: rework gitignore parsing --- default.nix | 145 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 119 insertions(+), 26 deletions(-) diff --git a/default.nix b/default.nix index 35a779a..452a454 100644 --- a/default.nix +++ b/default.nix @@ -3,40 +3,133 @@ # if evaluating inside the store, import the outputs.nix file let - # Ideally this file should not depend on nixpkgs lib itself, but I like the utilities here + # Ideally this file should be selfcontained, but I like the utilities in nixpkgs lib lib = (import "${(import ./inputs.nix {}).nixpkgs}/lib"); - gitignore = builtins.filter (v: - # ignore comments and empty lines - if !(builtins.isString v) then false - else if !builtins.isNull(builtins.match "^#.*" v) then false - else if !builtins.isNull(builtins.match "^$" v) then false - else true - ) (builtins.split "\n" (builtins.readFile ./.gitignore)); - - # checks if a given path matches a gitignore pattern - # string -> bool - matchesGitIgnore = path: builtins.any (pattern: - let - patternLength = builtins.stringLength pattern; - unsupportedPatternMessage = "matchesGitIgnore: Unsupported pattern: ${pattern}"; - in - if pattern == "*" then true - else if pattern == ".*" then true - else if pattern == "*.*" then true - else if builtins.substring 0 2 pattern == "*." then lib.hasSuffix (builtins.substring 0 2 pattern) path - else if lib.hasInfix "*" pattern then abort unsupportedPatternMessage - else if patternLength > 2 && builtins.substring 0 2 pattern == "./" then abort unsupportedPatternMessage - else if patternLength > 1 && builtins.substring 0 1 pattern == "/" then abort unsupportedPatternMessage - else lib.hasInfix pattern path - ) gitignore; + # function that takes gitignore file pattern and returns filter function + # true - include file + # false - exclude file + # null - no match + # string -> string -> [(string -> string -> (bool | null))] + toGitignoreMatcher = gitignorePath: pattern: lib.pipe pattern [ + (v: { pattern = v; invalid = false; }) + # trim whitespaces not preceded by backslash + (v: v // { pattern = let + stringLength = builtins.stringLength v.pattern; + leftPaddingLength = builtins.stringLength (lib.trimWith { start = true; end = false; } v.pattern) - stringLength; + rightPaddingLength = builtins.stringLength (lib.trimWith { start = false; end = true; } v.pattern) - stringLength; + isLastCharBackslash = if stringLength == 0 then false + else builtins.substring (stringLength - rightPaddingLength - 1) 1 v.pattern == "\\"; + trimmedString = builtins.substring leftPaddingLength (stringLength - leftPaddingLength - rightPaddingLength) v.pattern; + in if isLastCharBackslash && rightPaddingLength > 0 then trimmedString + " " else trimmedString; }) + # ignore empty lines + (v: if v.pattern != "" then v else v // { invalid = true; }) + # ignore comments + (v: if !v.invalid && builtins.substring 0 1 v.pattern != "#" then v else v // { invalid = true; }) + # mark negated patterns + (v: + if !v.invalid && builtins.substring 0 1 v.pattern == "!" + then v // { + negated = true; + pattern = builtins.substring 1 (builtins.stringLength v) v; + } + else v // { negated = false; } + ) + # ignore escapes + (v: if v.invalid then v else v // { pattern = builtins.replaceStrings ["\\"] [""] v.pattern; }) + # convert parsed pattern to matchers + ({ pattern, negated, invalid }: { + __functor = _: path: type: let + relative = builtins.match "^/.+[^/]$" pattern == []; + directory = builtins.match "/$" pattern == []; + regexPattern = lib.pipe pattern [ + (v: if relative then "${gitignorePath}/${v}" else v) + (builtins.split "/") + (builtins.filter (v: v != [])) + (builtins.map (builtins.split "(\\*\\*|\\*)")) + (builtins.concatMap (v: + # v: (string | [string])[] + if v == [ "" ] then [] + # TODO: check and add support for .. if git supports + else if v == [ "." ] then [] + else [( builtins.foldl' (acc: vp: + # vp: string | [string] + if builtins.isString vp then acc + lib.escapeRegex vp + else if vp == [ "**" ] then acc + ".*" + else if vp == [ "*" ] then acc + "[^/]*" + else throw "unreachable" + ) "" v )] + )) + (builtins.concatStringsSep "/" ) + (v: if relative then v else ".*/${v}") + ]; + matches = (!directory || type == "directory") + && (builtins.match regexPattern path == []); + in if invalid then null + else if matches then negated + else null; + # for debug purposes + inherit pattern negated; + # for filtering purposes + inherit invalid; + }) + ]; + + # TODO: optimize this so if match is found in a given gitignore, + # no further checks in gitignores in parent directories are performed + + parseGitignore = gitRepositoryPath: filePath: lib.pipe filePath [ + (builtins.dirOf) + (builtins.split "/" ) + (builtins.filter (v: v != [] && v != "")) + # ["a" "b" "c"] -> ["/" "/a/" "/a/b/" "/a/b/c/"] + ( + builtins.foldl' (acc: v: acc ++ [( + (builtins.elemAt acc (builtins.length acc - 1)) + "${v}/" + )] ) ["/"] + ) + (builtins.map (v: "${v}.gitignore")) + # Filter out paths that are not part of git repository and don't exist + (builtins.filter (v: lib.hasPrefix gitRepositoryPath v && builtins.pathExists v)) + (builtins.map (v: { + path = v; + # Split gitignore files into lines + contents = lib.pipe v [ + builtins.readFile + (builtins.split "\n") + # builtins.split uses lists for matches + (builtins.filter (v: v != [])) + ]; + })) + # Convert gitignore patterns to matchers + (builtins.map (v: + builtins.map (toGitignoreMatcher v.path) v.contents) + ) + lib.flatten + (lib.filter (v: !v.invalid)) + ]; + + runGitignoreFilter = filters: path: type: lib.pipe filters [ + (builtins.map (v: v path type)) + (builtins.filter (v: v != null)) + # If any filter didn't match anything, include the file + (v: if v == [] then [ true ] else v) + (v: builtins.elemAt v (builtins.length v - 1)) + ]; currentFilePath = (builtins.unsafeGetAttrPos "any" { any = "any"; }).file; storePathLength = builtins.stringLength (builtins.toString builtins.storeDir); evaluatingInStore = (builtins.substring 0 storePathLength currentFilePath) == builtins.storeDir; selfInStore = builtins.filterSource (path: type: - type != "unknown" && builtins.baseNameOf path != ".git" && !matchesGitIgnore path + let + selfPath = builtins.dirOf currentFilePath; + gitIgnoreFilters = parseGitignore selfPath path; + result = type != "unknown" + && type != "symlink" + && builtins.baseNameOf path != ".git" + && runGitignoreFilter gitIgnoreFilters path type; + in result ) ./.; in if !(evaluatingInStore) then { ... }@args: import selfInStore ({ selfPath = selfInStore; } // args ) From 2e82021280fdb4ab86a3b1e75e8e96318223905b Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 29 Jan 2025 10:24:34 +0100 Subject: [PATCH 128/218] nixos/cosmic: remove cosmic-player --- nix-os/desktopManagers/cosmic.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/desktopManagers/cosmic.nix b/nix-os/desktopManagers/cosmic.nix index 1dfb638..fd12dab 100644 --- a/nix-os/desktopManagers/cosmic.nix +++ b/nix-os/desktopManagers/cosmic.nix @@ -32,6 +32,7 @@ in services.desktopManager.cosmic.enable = true; environment.cosmic.excludePackages = with pkgs; [ cosmic-edit + cosmic-player cosmic-term ]; environment.systemPackages = with pkgs; [ From ae74f4e097e590250721c03d9f240f2d820a3dd4 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 29 Jan 2025 10:24:41 +0100 Subject: [PATCH 129/218] lock: update --- lock.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lock.nix b/lock.nix index e643ce3..4c842fe 100644 --- a/lock.nix +++ b/lock.nix @@ -4,15 +4,15 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "6a3ae7a5a12fb8cac2d59d7df7cbd95f9b2f0566"; - sha256 = "0srx4jvdqw14xmi0gsghynpki9fpadshnvsjzz4zv55fyf9hm3dk"; + revision = "4e96537f163fad24ed9eb317798a79afc85b51b7"; + sha256 = "1hzn20sc1n2jwkim8ms300dp56f0hrpj3y2h477mlxykkk2cyp0q"; }; nixpkgs-unstable = { - revision = "5df43628fdf08d642be8ba5b3625a6c70731c19c"; - sha256 = "05xhbk4yjbv0f760ld6q9z2v0nphakgk78kgd0wnnmzdjqqkbfad"; + revision = "852ff1d9e153d8875a83602e03fdef8a63f0ecf8"; + sha256 = "0f22vwxah4xhasfdi3lssk0kyng7xkjzygrz2d1wss3kpd523zb5"; }; cosmic-modules = { - revision = "6ec08f11bbf0e936ad82f1bb532f3757f8b5e3c2"; - sha256 = "055dwpmbp2q6xnrk1gdrql4w5w4cxb82d8ar7ma5z2kz0sfjf1yi"; + revision = "36eabddc2d033f4fd31c53570db7e1e21591cba3"; + sha256 = "0hy4phvqaz01nmn2vis5w794firjrg9kszd5wrdg9zyhkvgsmsp0"; }; } From bf4bdc5e4139d6368a897da719c6a4a92fb66306 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 29 Jan 2025 10:25:13 +0100 Subject: [PATCH 130/218] nixos/nvidia: add patches for 6.13 kernel --- nix-os/nvidia.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/nix-os/nvidia.nix b/nix-os/nvidia.nix index 1d4a068..c418cf5 100644 --- a/nix-os/nvidia.nix +++ b/nix-os/nvidia.nix @@ -22,6 +22,24 @@ openSha256 = "sha256-Fxo0t61KQDs71YA8u7arY+503wkAc1foaa51vi2Pl5I="; settingsSha256 = "sha256-VUetj3LlOSz/LB+DDfMCN34uA4bNTTpjDrb6C6Iwukk="; persistencedSha256 = "sha256-wnDjC099D8d9NJSp9D0CbsL+vfHXyJFYYgU3CwcqKww="; + patchesOpen = lib.map pkgs.fetchpatch [ + { + url = "https://github.com/CachyOS/CachyOS-PKGBUILDS/raw/1d09fe10034e497c8f362654fb09e96d5c01e49e/nvidia/nvidia-utils/0001-Make-modeset-and-fbdev-default-enabled.patch"; + hash = "sha256-1sunUtRQCBC3zB75YwXmwESZqaGm92L12Mcymt5pQ2U="; + } + { + url = "https://github.com/CachyOS/CachyOS-PKGBUILDS/raw/1d09fe10034e497c8f362654fb09e96d5c01e49e/nvidia/nvidia-utils/0008-Kbuild-Use-absolute-paths-for-symbolic-links.patch"; + hash = "sha256-7pf0lhbWna7dv6tgn8gZUMzZnTa9Gi7FiQQ+oba2Yj8="; + } + { + url = "https://github.com/CachyOS/CachyOS-PKGBUILDS/raw/1d09fe10034e497c8f362654fb09e96d5c01e49e/nvidia/nvidia-utils/0009-FROM-AOSC-Use-linux-aperture.c-for-removing-conflict.patch"; + hash = "sha256-zxr5Ljoeb2W0esu7JDB/w/5VM0RZuuB9BKr/rJ0zdQc="; + } + { + url = "https://github.com/CachyOS/CachyOS-PKGBUILDS/raw/1d09fe10034e497c8f362654fb09e96d5c01e49e/nvidia/nvidia-utils/0010-FROM-AOSC-TTM-fbdev-emulation-for-Linux-6.13.patch"; + hash = "sha256-dCVj43rF5ctuR9ORx6m0IaC8H3q+iGpvG/FBHTnpcZc="; + } + ]; }; }; nixpkgs.config.nvidia.acceptLicense = true; From 6659d98a612951b5061a8cc1db431aaa311d21ea Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 1 Feb 2025 20:01:17 +0100 Subject: [PATCH 131/218] pkgs/SPFlashTool5: init --- pkgs/by-name/sp/SPFlashTool5/package.nix | 84 ++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 pkgs/by-name/sp/SPFlashTool5/package.nix diff --git a/pkgs/by-name/sp/SPFlashTool5/package.nix b/pkgs/by-name/sp/SPFlashTool5/package.nix new file mode 100644 index 0000000..98612ca --- /dev/null +++ b/pkgs/by-name/sp/SPFlashTool5/package.nix @@ -0,0 +1,84 @@ +{ + lib, + autoPatchelfHook, + fetchurl, + fontconfig, + freetype, + glib, + libgcc, + libjpeg, + libpng12, + libz, + makeWrapper, + stdenvNoCC, + unrar, + xorg, +}: + +let + rarPassword = "spflashtool.com"; +in + +stdenvNoCC.mkDerivation (self: { + pname = "SPFlashTool5"; + version = "5.1916"; + src = fetchurl { + url = "https://spflashtool.com/files/SP_Flash_Tool-5.1916_Linux.rar"; + hash = "sha256-5lv/uPfUoke0IwjGuV/gTBt4kCbr95mwco3q9cjW/mE="; + curlOptsList = [ + "--referer" "https://spflashtool.com/download/" + ]; + }; + nativeBuildInputs = [ + autoPatchelfHook + fontconfig + freetype + glib + libgcc + libjpeg + libpng12 + libz + makeWrapper + unrar + xorg.libSM + xorg.libX11 + xorg.libXext + xorg.libXrender + ]; + unpackPhase = '' + runHook preUnpack + + unrar x -p${lib.escapeShellArg rarPassword} $src + cd */ + + runHook postUnpack + ''; + # remove plugins that have outdated dependencies not available in nixpkgs + # they are not needed to run the tool anyway + prePatch = '' + rm \ + plugins/imageformats/libqsvg.so \ + plugins/imageformats/libqmng.so \ + plugins/imageformats/libqtiff.so + ''; + dontConfigure = true; + dontBuild = true; + dontCheck = true; + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + mkdir -p $out/share/SPFlashTool5 + cp -r * $out/share/SPFlashTool5 + chmod +x $out/share/SPFlashTool5/flash_tool + makeWrapper $out/share/SPFlashTool5/flash_tool $out/bin/SPFlashTool5 + + runHook postInstall + ''; + meta = { + description = "Flash tool for MediaTek devices"; + homepage = "https://spflashtool.com/"; + license = lib.licenses.unfree; + maintainers = with lib.maintainers; [ amozeo ]; + }; +}) From e2a87b71db97a704706ba0056792a72ea83a232e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 1 Feb 2025 20:04:04 +0100 Subject: [PATCH 132/218] nixos/nvidia: update package --- nix-os/nvidia.nix | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/nix-os/nvidia.nix b/nix-os/nvidia.nix index c418cf5..835a87f 100644 --- a/nix-os/nvidia.nix +++ b/nix-os/nvidia.nix @@ -16,30 +16,12 @@ open = false; nvidiaSettings = true; package = config.boot.kernelPackages.nvidiaPackages.mkDriver { - version = "565.77"; - sha256_64bit = "sha256-CnqnQsRrzzTXZpgkAtF7PbH9s7wbiTRNcM0SPByzFHw="; - sha256_aarch64 = "sha256-LSAYUnhfnK3rcuPe1dixOwAujSof19kNOfdRHE7bToE="; - openSha256 = "sha256-Fxo0t61KQDs71YA8u7arY+503wkAc1foaa51vi2Pl5I="; - settingsSha256 = "sha256-VUetj3LlOSz/LB+DDfMCN34uA4bNTTpjDrb6C6Iwukk="; - persistencedSha256 = "sha256-wnDjC099D8d9NJSp9D0CbsL+vfHXyJFYYgU3CwcqKww="; - patchesOpen = lib.map pkgs.fetchpatch [ - { - url = "https://github.com/CachyOS/CachyOS-PKGBUILDS/raw/1d09fe10034e497c8f362654fb09e96d5c01e49e/nvidia/nvidia-utils/0001-Make-modeset-and-fbdev-default-enabled.patch"; - hash = "sha256-1sunUtRQCBC3zB75YwXmwESZqaGm92L12Mcymt5pQ2U="; - } - { - url = "https://github.com/CachyOS/CachyOS-PKGBUILDS/raw/1d09fe10034e497c8f362654fb09e96d5c01e49e/nvidia/nvidia-utils/0008-Kbuild-Use-absolute-paths-for-symbolic-links.patch"; - hash = "sha256-7pf0lhbWna7dv6tgn8gZUMzZnTa9Gi7FiQQ+oba2Yj8="; - } - { - url = "https://github.com/CachyOS/CachyOS-PKGBUILDS/raw/1d09fe10034e497c8f362654fb09e96d5c01e49e/nvidia/nvidia-utils/0009-FROM-AOSC-Use-linux-aperture.c-for-removing-conflict.patch"; - hash = "sha256-zxr5Ljoeb2W0esu7JDB/w/5VM0RZuuB9BKr/rJ0zdQc="; - } - { - url = "https://github.com/CachyOS/CachyOS-PKGBUILDS/raw/1d09fe10034e497c8f362654fb09e96d5c01e49e/nvidia/nvidia-utils/0010-FROM-AOSC-TTM-fbdev-emulation-for-Linux-6.13.patch"; - hash = "sha256-dCVj43rF5ctuR9ORx6m0IaC8H3q+iGpvG/FBHTnpcZc="; - } - ]; + version = "570.86.16"; + sha256_64bit = "sha256-RWPqS7ZUJH9JEAWlfHLGdqrNlavhaR1xMyzs8lJhy9U="; + sha256_aarch64 = "sha256-RiO2njJ+z0DYBo/1DKa9GmAjFgZFfQ1/1Ga+vXG87vA="; + openSha256 = "sha256-DuVNA63+pJ8IB7Tw2gM4HbwlOh1bcDg2AN2mbEU9VPE="; + settingsSha256 = "sha256-9rtqh64TyhDF5fFAYiWl3oDHzKJqyOW3abpcf2iNRT8="; + persistencedSha256 = "sha256-3mp9X/oV8o2TH9720NnoXROxQ4g98nNee+DucXpQy3w="; }; }; nixpkgs.config.nvidia.acceptLicense = true; From 37f4ff706a1646ff0b8a94f613b56f7e163810d2 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 1 Feb 2025 20:11:32 +0100 Subject: [PATCH 133/218] lock: update --- lock.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lock.nix b/lock.nix index 4c842fe..0264f82 100644 --- a/lock.nix +++ b/lock.nix @@ -4,15 +4,15 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "4e96537f163fad24ed9eb317798a79afc85b51b7"; - sha256 = "1hzn20sc1n2jwkim8ms300dp56f0hrpj3y2h477mlxykkk2cyp0q"; + revision = "666e1b3f09c267afd66addebe80fb05a5ef2b554"; + sha256 = "02cpqb4zdirzxfj210viim1lknpp0flvwcc1a2knmrmhl1f9dgz8"; }; nixpkgs-unstable = { - revision = "852ff1d9e153d8875a83602e03fdef8a63f0ecf8"; - sha256 = "0f22vwxah4xhasfdi3lssk0kyng7xkjzygrz2d1wss3kpd523zb5"; + revision = "9d3ae807ebd2981d593cddd0080856873139aa40"; + sha256 = "0bjqgsprq9fgl5yh58dk59xmchi4dajq3sf5i447q02dbiasjsil"; }; cosmic-modules = { - revision = "36eabddc2d033f4fd31c53570db7e1e21591cba3"; - sha256 = "0hy4phvqaz01nmn2vis5w794firjrg9kszd5wrdg9zyhkvgsmsp0"; + revision = "51b9cce097da369550f45ac07879274dc8be81e4"; + sha256 = "05yqalyfc76hbmpfsf08n6nkl064m9kj0r87x6zbrri9iphjvnyb"; }; } From 08c9fa55456589da72584ed4eb2f79d19d2c6c86 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 9 Feb 2025 03:23:07 +0100 Subject: [PATCH 134/218] outputs: merge pipe expression add comments too --- outputs.nix | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/outputs.nix b/outputs.nix index dd3f3ca..62dbeb2 100644 --- a/outputs.nix +++ b/outputs.nix @@ -19,26 +19,24 @@ self = { versionInfoFixup = import ./pkgs/overlays/version-info-fixup.nix { inherit inputs; }; }; nixosConfigurations = let - # list nix file paths in ./hosts to attributes in nixosConfigurations - filePaths = lib.pipe ./hosts [ - builtins.readDir - ( lib.filterAttrs (name: type: - ( # regular .nix files - (type == "regular" && lib.hasSuffix ".nix" name) - || # directories that contain a default.nix file - (type == "directory" && builtins.pathExists "${./.}/hosts/${name}/default.nix") - ) - # filter out files that start with . - && !lib.hasPrefix "." name - )) - ]; nixosSystem = import "${inputs.nixpkgs}/nixos/lib/eval-config.nix"; in - # mapped list of nix file paths to attrSet with initialized NixOS configurations, + # mapped atrrsed of nix file paths to attrSet with initialized NixOS configurations, # whose names are derived from file names - lib.pipe filePaths [ + lib.pipe ./hosts [ + builtins.readDir + # filter out files that are not .nix files, directories with default.nix or starting with . (dot, hidden files) + ( lib.filterAttrs (name: type: + ( + (type == "regular" && lib.hasSuffix ".nix" name) + || (type == "directory" && builtins.pathExists "${./.}/hosts/${name}/default.nix") + ) + && !lib.hasPrefix "." name + )) (builtins.mapAttrs (name: type: { + # remove .nix extension name = if type == "directory" then name else builtins.substring 0 (builtins.stringLength name - 4) name; + # initialize NixOS configuration value = nixosSystem { inherit lib; modules = [ From 081c00b7bcf99fb4d15b494613113d749d182963 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 9 Feb 2025 03:23:43 +0100 Subject: [PATCH 135/218] outputs: fix typo --- outputs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.nix b/outputs.nix index 62dbeb2..1c25428 100644 --- a/outputs.nix +++ b/outputs.nix @@ -21,7 +21,7 @@ self = { nixosConfigurations = let nixosSystem = import "${inputs.nixpkgs}/nixos/lib/eval-config.nix"; in - # mapped atrrsed of nix file paths to attrSet with initialized NixOS configurations, + # mapped attrset of nix file paths to attrSet with initialized NixOS configurations, # whose names are derived from file names lib.pipe ./hosts [ builtins.readDir From 5d9f3332b8254b6045e64932941ee70ba8f3a7d1 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 9 Feb 2025 03:52:25 +0100 Subject: [PATCH 136/218] outputs: factor out mkNixosSystem I hope this makes this file more readable --- outputs.nix | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/outputs.nix b/outputs.nix index 1c25428..cb46fbd 100644 --- a/outputs.nix +++ b/outputs.nix @@ -20,6 +20,20 @@ self = { }; nixosConfigurations = let nixosSystem = import "${inputs.nixpkgs}/nixos/lib/eval-config.nix"; + mkNixosSystem = path: nixosSystem { + inherit lib; + modules = [ + path + { + config.nixpkgs.overlays = [ + ( import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = "${self}/pkgs/top-level/impure.nix"; } ) + ( import ./pkgs/top-level/by-name-overlay.nix "${self}/pkgs/by-name" ) + self.overlays.versionInfoFixup + ]; + } + ]; + specialArgs = { inherit self inputs; }; + }; in # mapped attrset of nix file paths to attrSet with initialized NixOS configurations, # whose names are derived from file names @@ -37,20 +51,7 @@ self = { # remove .nix extension name = if type == "directory" then name else builtins.substring 0 (builtins.stringLength name - 4) name; # initialize NixOS configuration - value = nixosSystem { - inherit lib; - modules = [ - ./hosts/${name} - { - config.nixpkgs.overlays = [ - ( import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = "${self}/pkgs/top-level/impure.nix"; } ) - ( import ./pkgs/top-level/by-name-overlay.nix "${self}/pkgs/by-name" ) - self.overlays.versionInfoFixup - ]; - } - ]; - specialArgs = { inherit self inputs; }; - }; + value = mkNixosSystem ./hosts/${name}; })) builtins.attrValues builtins.listToAttrs From ec91266fcd12f16d8ca355ab70a14f2b4c2c4691 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 9 Feb 2025 08:23:49 +0100 Subject: [PATCH 137/218] pkgs/overlays/unstable-latest: init this reuses code that was removed in 77ef7434f24baa95c6929a9e532967b0e58b7294 --- pkgs/overlays/unstable-from-source.nix | 3 ++- pkgs/overlays/unstable-latest.nix | 25 +++++++++++++++++++++++++ pkgs/top-level/default.nix | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 pkgs/overlays/unstable-latest.nix diff --git a/pkgs/overlays/unstable-from-source.nix b/pkgs/overlays/unstable-from-source.nix index 214307d..9f9499c 100644 --- a/pkgs/overlays/unstable-from-source.nix +++ b/pkgs/overlays/unstable-from-source.nix @@ -1,5 +1,6 @@ { unstableSource, + attributeName ? "unstable", }: self: super: @@ -32,5 +33,5 @@ let }); in { - unstable = if useUnstable then unstablePkgsForNixpkgs self else self; + "${attributeName}" = if useUnstable then unstablePkgsForNixpkgs self else self; } diff --git a/pkgs/overlays/unstable-latest.nix b/pkgs/overlays/unstable-latest.nix new file mode 100644 index 0000000..68636c0 --- /dev/null +++ b/pkgs/overlays/unstable-latest.nix @@ -0,0 +1,25 @@ +self: super: + +let + nixos = self.config.unstable-latest.nixos or true; + useUnstable = self.config.useUnstable or true; + + unstablePkgsExprs = if nixos + then builtins.fetchTarball "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz" + else builtins.fetchTarball "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; + + # Compiled nixpkgs expression eg expressions from a nix channel + nixpkgsVersion = builtins.concatStringsSep "." [ + (builtins.readFile "${unstablePkgsExprs}/.version") + (builtins.readFile "${unstablePkgsExprs}/.version-suffix") + ]; + + nixpkgsRevision = (builtins.readFile "${unstablePkgsExprs}/.git-revision"); +in +import ./unstable-from-source.nix { + unstableSource = unstablePkgsExprs; + attributeName = "unstable-latest"; +} self super // { + unstableLatestVersion = if !useUnstable then null else nixpkgsVersion; + unstableLatestRevision = if !useUnstable then null else nixpkgsRevision; +} diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index dfdae8b..34637da 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -15,6 +15,7 @@ let # ../.. should be nix store path that represents self in outputs.nix that is gc-rooted by this point ( import ../overlays/selfExpr.nix { nixpkgsPath = "${builtins.toString ../..}/pkgs/top-level/impure.nix"; } ) ( import ../overlays/unstable-with-meta.nix { unstableSource = inputs.nixpkgs-unstable; revision = inputs.lock.nixpkgs-unstable.revision; } ) + ( import ../overlays/unstable-latest.nix ) ( import ../overlays/version-info-fixup.nix { inherit inputs; } ) ( import ./by-name-overlay.nix ../by-name ) ]; From be62805cc68033fa7a7c2ad576fffe50b31a100f Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 9 Feb 2025 08:53:27 +0100 Subject: [PATCH 138/218] ouptuts: create packages set --- outputs.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/outputs.nix b/outputs.nix index cb46fbd..d6b8a54 100644 --- a/outputs.nix +++ b/outputs.nix @@ -7,11 +7,29 @@ let lib = (import "${inputs.nixpkgs}/lib").extend (import ./lib/overlays/version-info-fixup.nix { revision = inputs.lock.nixpkgs.revision; }); +systems = [ + "x86_64-linux" + "aarch64-linux" +]; + +# (system -> x) -> { [system] := x } +forEachSystem = x: lib.pipe systems [ + (builtins.map (system: { name = system; value = x system; })) + builtins.listToAttrs +]; + self = { inherit inputs lib self; outPath = selfPath; modifiedNixpkgs = import ./pkgs/top-level/impure.nix; modifiedNixpkgsPure = import ./pkgs/top-level/default.nix; + packagesForSystem = system: self.modifiedNixpkgsPure { localSystem = system; }; + packages = forEachSystem (system: let + nixpkgs = import "${inputs.nixpkgs}/pkgs/top-level/default.nix" { localSystem = system; }; + attrnames = builtins.attrNames nixpkgs; + in + builtins.removeAttrs (self.pkgsForSystem system) attrnames + ); overlays = { cosmicPackages = import ./pkgs/overlays/cosmic-packages.nix { inherit inputs; }; selfExpr = import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = inputs.nixpkgs; }; From 5c01a58f54e4a4fe5c10cfbbea4289e1ad4a7982 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 9 Feb 2025 09:17:51 +0100 Subject: [PATCH 139/218] nixos/{core; nix}: factor out nix overriding --- nix-os/core.nix | 25 ++----------------------- nix-os/nix.nix | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 23 deletions(-) create mode 100644 nix-os/nix.nix diff --git a/nix-os/core.nix b/nix-os/core.nix index 4252607..09c5d4a 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -4,28 +4,10 @@ { inputs, lib, pkgs, ... }: -let - inherit (pkgs) mkWrappedExecutable; - - # bool -> nixpkgs[] - wrappedNixExecutables = inEnvironment: assert builtins.isBool inEnvironment; [ - (mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-build"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar${lib.optionalString inEnvironment "-with-logs"}"];}) - (mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-shell"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar"];}) - ]; - wrappedNixosExecutables = [ - (mkWrappedExecutable {pkg = pkgs.nixos-rebuild; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar"];}) - ]; - wrappedNix = (pkgs.buildEnv { - name = "wrappedNix-${pkgs.nix.version}"; - paths = [ pkgs.nix ] ++ wrappedNixExecutables false; - }).overrideAttrs { - version = pkgs.nix.version; - passthru.meta = pkgs.nix.meta; - }; -in { imports = [ ./module-overrides.nix + ./nix.nix ]; # kernel @@ -37,7 +19,6 @@ in # Allow unfree packages nixpkgs.config.allowUnfree = true; nix = { - package = wrappedNix; channel.enable = false; settings.experimental-features = [ "no-url-literals" @@ -62,9 +43,7 @@ in fastfetch smartmontools ddrescue - ] ++ wrappedNixExecutables true - ++ wrappedNixosExecutables; - + ]; programs.git.enable = true; programs.git.config = { commit.verbose = true; diff --git a/nix-os/nix.nix b/nix-os/nix.nix new file mode 100644 index 0000000..fe6b00a --- /dev/null +++ b/nix-os/nix.nix @@ -0,0 +1,33 @@ +{ + lib, + pkgs, + ... +}: + +let + inherit (pkgs) mkWrappedExecutable; + + # bool -> nixpkgs[] + wrappedNixExecutables = inEnvironment: assert builtins.isBool inEnvironment; [ + (mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-build"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar${lib.optionalString inEnvironment "-with-logs"}"];}) + (mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-shell"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar"];}) + ]; + wrappedNixosExecutables = [ + (mkWrappedExecutable {pkg = pkgs.nixos-rebuild; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar"];}) + ]; + wrappedNix = (pkgs.buildEnv { + name = "wrappedNix-${pkgs.nix.version}"; + paths = [ pkgs.nix ] ++ wrappedNixExecutables false; + }).overrideAttrs { + version = pkgs.nix.version; + passthru.meta = pkgs.nix.meta; + }; +in { + config = { + nix.package = wrappedNix; + environment.systemPackages = lib.map (lib.hiPrio) [ + (wrappedNixExecutables true) + wrappedNixosExecutables + ]; + }; +} From b5e40f0d643721125d2adc45c150fdb88d202d8e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 9 Feb 2025 09:18:57 +0100 Subject: [PATCH 140/218] nixos/nix: remove use of mkWrappedExecutable and buildEnv --- nix-os/nix.nix | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/nix-os/nix.nix b/nix-os/nix.nix index fe6b00a..9a7b7c4 100644 --- a/nix-os/nix.nix +++ b/nix-os/nix.nix @@ -5,19 +5,37 @@ }: let - inherit (pkgs) mkWrappedExecutable; - + makeWrapper = "${pkgs.makeWrapper}/nix-support/setup-hook"; # bool -> nixpkgs[] - wrappedNixExecutables = inEnvironment: assert builtins.isBool inEnvironment; [ - (mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-build"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar${lib.optionalString inEnvironment "-with-logs"}"];}) - (mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-shell"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar"];}) - ]; - wrappedNixosExecutables = [ - (mkWrappedExecutable {pkg = pkgs.nixos-rebuild; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar"];}) - ]; - wrappedNix = (pkgs.buildEnv { + wrappedNixExecutables = inEnvironment: assert builtins.isBool inEnvironment; pkgs.symlinkJoin { + name = "${pkgs.nix.name}-wrap"; + paths = [ pkgs.nix ]; + postBuild = '' + . ${makeWrapper} + wrapProgram $out/bin/nix-build \ + --add-flags "--log-format" \ + --add-flags "bar${lib.optionalString inEnvironment "-with-logs"}" + wrapProgram $out/bin/nix-shell \ + --add-flags "--log-format" \ + --add-flags "bar" + ''; + }; + + wrappedNixosExecutables = pkgs.symlinkJoin { + name = "${pkgs.nixos-rebuild.name}-wrap"; + paths = [ pkgs.nixos-rebuild ]; + postBuild = '' + . ${makeWrapper} + wrapProgram $out/bin/nixos-rebuild \ + --add-flags "--log-format" \ + --add-flags "bar" + ''; + }; + + + wrappedNix = (pkgs.symlinkJoin { name = "wrappedNix-${pkgs.nix.version}"; - paths = [ pkgs.nix ] ++ wrappedNixExecutables false; + paths = [ pkgs.nix ] ++ [( wrappedNixExecutables false )]; }).overrideAttrs { version = pkgs.nix.version; passthru.meta = pkgs.nix.meta; From e176ea94832dca1b53e93b36a67e456a5ececb53 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 9 Feb 2025 09:30:20 +0100 Subject: [PATCH 141/218] pkgs/mk{WrappedExecutable; ScriptOverride}: remove --- pkgs/by-name/mk/mkScriptOverride/package.nix | 31 ------------------- .../mk/mkWrappedExecutable/package.nix | 22 ------------- 2 files changed, 53 deletions(-) delete mode 100644 pkgs/by-name/mk/mkScriptOverride/package.nix delete mode 100644 pkgs/by-name/mk/mkWrappedExecutable/package.nix diff --git a/pkgs/by-name/mk/mkScriptOverride/package.nix b/pkgs/by-name/mk/mkScriptOverride/package.nix deleted file mode 100644 index 0b71a07..0000000 --- a/pkgs/by-name/mk/mkScriptOverride/package.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - lib, - stdenv, -}: - -{ - src, - script, - ... -} @ args: -lib.hiPrio (stdenv.mkDerivation ( - { - src = src; - name = if lib.isDerivation src - then "${src.name}-script-override" - else "${builtins.baseNameOf src}-script-override"; - phases = [ "installPhase" "scriptOverridePhase" ]; - installPhase = '' - runHook preInstall - - cp -r $src $out - chmod u+w -R $out - - runHook postInstall - ''; - scriptOverridePhase = script; - } // lib.removeAttrs args [ - "src" - "script" - ] -)) diff --git a/pkgs/by-name/mk/mkWrappedExecutable/package.nix b/pkgs/by-name/mk/mkWrappedExecutable/package.nix deleted file mode 100644 index 039b6f4..0000000 --- a/pkgs/by-name/mk/mkWrappedExecutable/package.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - lib, - makeWrapper, - stdenv -}: - -/* - pkg: package - nixpkgs package - exe: string - executable (under bin) in pkg - wrapperArgs: string[] - arguments to pass to the wrapper -*/ -{ pkg, exe ? pkg.meta.mainProgram, wrapperArgs }: -lib.hiPrio (stdenv.mkDerivation { - inherit wrapperArgs; - name = "${pkg.name}-wrap-${exe}"; - nativeBuildInputs = [ makeWrapper ]; - phases = ["installPhase"]; - installPhase = '' - mkdir -p $out/bin - makeWrapper ${pkg}/bin/${exe} $out/bin/${exe} $wrapperArgs - ''; -}) From 7828941e12e61d6243858c46f72acf4310a19009 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 9 Feb 2025 09:32:01 +0100 Subject: [PATCH 142/218] nixos/core: remove comment and format module args --- nix-os/core.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index 09c5d4a..39ae485 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -1,8 +1,9 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running 'nixos-help'). - -{ inputs, lib, pkgs, ... }: +{ + inputs, + lib, + pkgs, + ... +}: { imports = [ From bff3e5c2aa8b27ba4aa5c363cac3d6750a3879fd Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 9 Feb 2025 11:44:54 +0100 Subject: [PATCH 143/218] outputs: fix typo --- outputs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.nix b/outputs.nix index d6b8a54..9f619ac 100644 --- a/outputs.nix +++ b/outputs.nix @@ -28,7 +28,7 @@ self = { nixpkgs = import "${inputs.nixpkgs}/pkgs/top-level/default.nix" { localSystem = system; }; attrnames = builtins.attrNames nixpkgs; in - builtins.removeAttrs (self.pkgsForSystem system) attrnames + builtins.removeAttrs (self.packagesForSystem system) attrnames ); overlays = { cosmicPackages = import ./pkgs/overlays/cosmic-packages.nix { inherit inputs; }; From f6b3bea7cba1e2bc6b3cb947af4c8cb3b5478a41 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 9 Feb 2025 12:11:36 +0100 Subject: [PATCH 144/218] lock: update --- lock.nix | 12 ++++++------ pkgs/overlays/unstable-from-source.nix | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lock.nix b/lock.nix index 0264f82..bfa17f0 100644 --- a/lock.nix +++ b/lock.nix @@ -4,15 +4,15 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "666e1b3f09c267afd66addebe80fb05a5ef2b554"; - sha256 = "02cpqb4zdirzxfj210viim1lknpp0flvwcc1a2knmrmhl1f9dgz8"; + revision = "f5a32fa27df91dfc4b762671a0e0a859a8a0058f"; + sha256 = "0w84lcpxxqzpab7qrdrf4szpij27q906kgckclqxb3q533ir07zg"; }; nixpkgs-unstable = { - revision = "9d3ae807ebd2981d593cddd0080856873139aa40"; - sha256 = "0bjqgsprq9fgl5yh58dk59xmchi4dajq3sf5i447q02dbiasjsil"; + revision = "a79cfe0ebd24952b580b1cf08cd906354996d547"; + sha256 = "1imkffvs7h2c9ppf00jb6m5ah9zk46i3dqxmzm4x4dfdiw5c92wq"; }; cosmic-modules = { - revision = "51b9cce097da369550f45ac07879274dc8be81e4"; - sha256 = "05yqalyfc76hbmpfsf08n6nkl064m9kj0r87x6zbrri9iphjvnyb"; + revision = "28fb2017077f66b050f031f8442475d1b51c908e"; + sha256 = "18a3y3yd6q0fww4bhmfy9dvpns74szg55mmsv38iz3x1qhjaw9mf"; }; } diff --git a/pkgs/overlays/unstable-from-source.nix b/pkgs/overlays/unstable-from-source.nix index 9f9499c..c7481ff 100644 --- a/pkgs/overlays/unstable-from-source.nix +++ b/pkgs/overlays/unstable-from-source.nix @@ -12,6 +12,7 @@ let "emulatorAvailable" "darwinSdkVersion" "darwinMinVersion" + "parsed" ]; unstablePkgsForNixpkgs = nixpkgs: import unstableSource { From ab2379f5e57deb62eb322c0380ac16d0b6487862 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 17 Feb 2025 03:35:53 +0100 Subject: [PATCH 145/218] lock: update --- lock.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lock.nix b/lock.nix index bfa17f0..8cf15a1 100644 --- a/lock.nix +++ b/lock.nix @@ -4,15 +4,15 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "f5a32fa27df91dfc4b762671a0e0a859a8a0058f"; - sha256 = "0w84lcpxxqzpab7qrdrf4szpij27q906kgckclqxb3q533ir07zg"; + revision = "0b73e36b1962620a8ac551a37229dd8662dac5c8"; + sha256 = "15avzb7r8iflfsl4glcvgqk1bn4fy9xr7fq7cjw8lg1vsg6qndf2"; }; nixpkgs-unstable = { - revision = "a79cfe0ebd24952b580b1cf08cd906354996d547"; - sha256 = "1imkffvs7h2c9ppf00jb6m5ah9zk46i3dqxmzm4x4dfdiw5c92wq"; + revision = "2ff53fe64443980e139eaa286017f53f88336dd0"; + sha256 = "0ms5nbr2vmvhbr531bxvyi10nz9iwh5cry12pl416gyvf0mxixpv"; }; cosmic-modules = { - revision = "28fb2017077f66b050f031f8442475d1b51c908e"; - sha256 = "18a3y3yd6q0fww4bhmfy9dvpns74szg55mmsv38iz3x1qhjaw9mf"; + revision = "51f16d9cd5ab24afa8b940d0e5c83965c46ef430"; + sha256 = "1xvp160gd46bx0fhbyls75dmsq05qhcxkd2mwy3irzg8di1986ny"; }; } From 5e16b1b0b161c0a077a0068dd5416441c10cc59d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 17 Feb 2025 19:31:00 +0100 Subject: [PATCH 146/218] pkgs/overlays/unstable-from-source: use lib.systems.equals for comparing platforms --- pkgs/overlays/unstable-from-source.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/overlays/unstable-from-source.nix b/pkgs/overlays/unstable-from-source.nix index c7481ff..bca6b9f 100644 --- a/pkgs/overlays/unstable-from-source.nix +++ b/pkgs/overlays/unstable-from-source.nix @@ -27,11 +27,13 @@ let # crossOverlays -> partial of pkgs.overlays # crossOverlays are merged to overlays, not sure what issues that might raise. # ignoring. - } // (if nixpkgs.stdenv.buildPlatform == nixpkgs.stdenv.hostPlatform then {} else { + } // self.lib.optionalAttrs ( + self.lib.systems.equals nixpkgs.stdenv.buildPlatform nixpkgs.stdenv.hostPlatform + ) { # workaround for some odd structured packages that changes behaviour # when crossSystem is passed. crossSystem = sanitizePlatform nixpkgs.stdenv.hostPlatform; - }); + }; in { "${attributeName}" = if useUnstable then unstablePkgsForNixpkgs self else self; From 762e4cf52a22cba2ad966bbd8c26489d68d7a95d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 18 Feb 2025 04:24:20 +0100 Subject: [PATCH 147/218] nixos: remove invalid mkDoc, mdDoc uses --- nix-os/generic/dconf.nix | 8 ++++---- nix-os/unstable-packages.nix | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nix-os/generic/dconf.nix b/nix-os/generic/dconf.nix index dfcdc04..0ef11d7 100644 --- a/nix-os/generic/dconf.nix +++ b/nix-os/generic/dconf.nix @@ -10,12 +10,12 @@ let rulesToApply = lib.mkOption { type = lib.types.listOf lib.types.str; default = lib.attrNames cfg.rules; - description = lib.mdDoc "A list of rules keys to apply for profile"; + description = "A list of rules keys to apply for profile"; }; extraRules = lib.mkOption { type = lib.types.attrs; default = {}; - description = lib.mdDoc "An attrset of additional dconf rules to apply ontop of selected"; + description = "An attrset of additional dconf rules to apply ontop of selected"; }; }; }; @@ -31,12 +31,12 @@ in rules = lib.mkOption { type = lib.types.attrs; default = {}; - description = lib.mdDoc "An attrset of dconf rules to pull from"; + description = "An attrset of dconf rules to pull from"; }; profiles = lib.mkOption { type = lib.types.attrsOf profileOpts; default = {}; - description = lib.mdDoc "An attret of profiles to create, with pulled rules"; + description = "An attret of profiles to create, with pulled rules"; }; }; diff --git a/nix-os/unstable-packages.nix b/nix-os/unstable-packages.nix index b39d9f4..10fefa5 100644 --- a/nix-os/unstable-packages.nix +++ b/nix-os/unstable-packages.nix @@ -12,9 +12,9 @@ let in { options.unstable = { - enable = lib.mkEnableOption (lib.mkDoc '' + enable = lib.mkEnableOption '' use of unstable packages in configuration. You can use `unstablePkgs` in configuration modules - '') // { default = true; }; + '' // { default = true; }; }; config = { _module.args.unstablePkgs = if config.unstable.enable then pkgs.unstable else pkgs; From 37801ab26fd4c68781d493b88371a86d7818c221 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 22 Feb 2025 12:07:57 +0100 Subject: [PATCH 148/218] nixos/nix: properly use makeWrapper hook --- nix-os/nix.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nix-os/nix.nix b/nix-os/nix.nix index 9a7b7c4..a3c00db 100644 --- a/nix-os/nix.nix +++ b/nix-os/nix.nix @@ -5,13 +5,14 @@ }: let - makeWrapper = "${pkgs.makeWrapper}/nix-support/setup-hook"; # bool -> nixpkgs[] wrappedNixExecutables = inEnvironment: assert builtins.isBool inEnvironment; pkgs.symlinkJoin { name = "${pkgs.nix.name}-wrap"; paths = [ pkgs.nix ]; + nativeBuildInputs = [ + pkgs.makeWrapper + ]; postBuild = '' - . ${makeWrapper} wrapProgram $out/bin/nix-build \ --add-flags "--log-format" \ --add-flags "bar${lib.optionalString inEnvironment "-with-logs"}" @@ -24,8 +25,10 @@ let wrappedNixosExecutables = pkgs.symlinkJoin { name = "${pkgs.nixos-rebuild.name}-wrap"; paths = [ pkgs.nixos-rebuild ]; + nativeBuildInputs = [ + pkgs.makeWrapper + ]; postBuild = '' - . ${makeWrapper} wrapProgram $out/bin/nixos-rebuild \ --add-flags "--log-format" \ --add-flags "bar" From e4d8bfada58057123ac11e3848cf363bdcc7c9a9 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 24 Feb 2025 12:54:04 +0100 Subject: [PATCH 149/218] nixos/nix-binary-cache: create nix cache signing key if doesn't exists --- nix-os/services/nix-binary-cache.nix | 45 +++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/nix-os/services/nix-binary-cache.nix b/nix-os/services/nix-binary-cache.nix index 923b0bc..3dd7ad6 100644 --- a/nix-os/services/nix-binary-cache.nix +++ b/nix-os/services/nix-binary-cache.nix @@ -1,11 +1,54 @@ -{ pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { + options = { + services.nix-serve = { + keyName = lib.mkOption { + type = lib.types.str; + default = config.networking.fqdnOrHostName; + defaultText = "config.networking.fqdnOrHostName"; + description = "Name of the key when generating (usually domain name)"; + }; + publicKeyFile = lib.mkOption { + type = lib.types.path; + default = "/var/cache-pub-key.pem"; + description = "Path to the public key file"; + }; + }; + }; config = { services.nix-serve = { enable = true; package = pkgs.nix-serve-ng; secretKeyFile = "/var/cache-priv-key.pem"; }; + systemd.services.nix-serve-generate-key = let + inherit (config.services.nix-serve) keyName secretKeyFile publicKeyFile; + in { + description = "Ensure existence of nix binary cache signing key"; + wantedBy = [ config.systemd.services.nix-serve.name ]; + script = '' + if [ -f ${secretKeyFile} ]; then + echo "File ${secretKeyFile} already exists, nothing to do" >&2 + exit 0 + fi + if [ -a ${secretKeyFile} ]; then + echo "File ${secretKeyFile} is not a regular file" >&2 + exit 1 + fi + echo "Generating nix binary cache signing key" >&2 + touch ${secretKeyFile} + chmod 600 ${secretKeyFile} + mkdir -p $(dirname ${secretKeyFile}) + ${lib.getExe' pkgs.nix "nix-store"} --generate-binary-cache-key \ + ${keyName} ${secretKeyFile} ${publicKeyFile} + ''; + restartIfChanged = true; + }; }; } From 6a1b7d27c0359b54b273101008d1643592125a25 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 27 Feb 2025 21:27:53 +0100 Subject: [PATCH 150/218] lock: update --- lock.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lock.nix b/lock.nix index 8cf15a1..38ae8c7 100644 --- a/lock.nix +++ b/lock.nix @@ -4,15 +4,15 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "0b73e36b1962620a8ac551a37229dd8662dac5c8"; - sha256 = "15avzb7r8iflfsl4glcvgqk1bn4fy9xr7fq7cjw8lg1vsg6qndf2"; + revision = "5d7db4668d7a0c6cc5fc8cf6ef33b008b2b1ed8b"; + sha256 = "1xxfs0jk98236v3h7gwhhai7j33sri0phvgp5ng24x4lfvznwy71"; }; nixpkgs-unstable = { - revision = "2ff53fe64443980e139eaa286017f53f88336dd0"; - sha256 = "0ms5nbr2vmvhbr531bxvyi10nz9iwh5cry12pl416gyvf0mxixpv"; + revision = "5135c59491985879812717f4c9fea69604e7f26f"; + sha256 = "09qy7zv80bkd9ighsw0bdxjq70dw3qjnyvg7il1fycrsgs5x1gan"; }; cosmic-modules = { - revision = "51f16d9cd5ab24afa8b940d0e5c83965c46ef430"; - sha256 = "1xvp160gd46bx0fhbyls75dmsq05qhcxkd2mwy3irzg8di1986ny"; + revision = "c5a9b54c1ed6586e60ed6acd2178704ce1824c19"; + sha256 = "1wagkh8xkpq06nzwfy7jpjgr2wnigk15871jcvap3k3p4is3ykik"; }; } From dc0351c2c9e7601f8cda81e4f0f9ed32ea22e278 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 27 Feb 2025 21:29:19 +0100 Subject: [PATCH 151/218] outputs: use lib.genAttrs for system attrset generation --- outputs.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/outputs.nix b/outputs.nix index 9f619ac..adc23e6 100644 --- a/outputs.nix +++ b/outputs.nix @@ -13,10 +13,7 @@ systems = [ ]; # (system -> x) -> { [system] := x } -forEachSystem = x: lib.pipe systems [ - (builtins.map (system: { name = system; value = x system; })) - builtins.listToAttrs -]; +forEachSystem = lib.genAttrs systems; self = { inherit inputs lib self; From d874ae3c0b7ce48993a340925b24df34cef1926c Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 27 Feb 2025 21:32:30 +0100 Subject: [PATCH 152/218] pkgs/SPFlashTool5: use buildInputs for libraries --- pkgs/by-name/sp/SPFlashTool5/package.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/sp/SPFlashTool5/package.nix b/pkgs/by-name/sp/SPFlashTool5/package.nix index 98612ca..d837743 100644 --- a/pkgs/by-name/sp/SPFlashTool5/package.nix +++ b/pkgs/by-name/sp/SPFlashTool5/package.nix @@ -31,6 +31,10 @@ stdenvNoCC.mkDerivation (self: { }; nativeBuildInputs = [ autoPatchelfHook + makeWrapper + unrar + ]; + buildInputs = [ fontconfig freetype glib @@ -38,8 +42,6 @@ stdenvNoCC.mkDerivation (self: { libjpeg libpng12 libz - makeWrapper - unrar xorg.libSM xorg.libX11 xorg.libXext From 285eed58c43c477449748aa54ef7dd362e6e8e1f Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 27 Feb 2025 21:45:30 +0100 Subject: [PATCH 153/218] pkgs/SPFlashTool5: update to 5.228, use spflashtools for source --- pkgs/by-name/sp/SPFlashTool5/package.nix | 27 ++++++------------------ 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/pkgs/by-name/sp/SPFlashTool5/package.nix b/pkgs/by-name/sp/SPFlashTool5/package.nix index d837743..6e155d5 100644 --- a/pkgs/by-name/sp/SPFlashTool5/package.nix +++ b/pkgs/by-name/sp/SPFlashTool5/package.nix @@ -11,28 +11,21 @@ libz, makeWrapper, stdenvNoCC, - unrar, + unzip, xorg, }: -let - rarPassword = "spflashtool.com"; -in - stdenvNoCC.mkDerivation (self: { pname = "SPFlashTool5"; - version = "5.1916"; + version = "5.2228"; src = fetchurl { - url = "https://spflashtool.com/files/SP_Flash_Tool-5.1916_Linux.rar"; - hash = "sha256-5lv/uPfUoke0IwjGuV/gTBt4kCbr95mwco3q9cjW/mE="; - curlOptsList = [ - "--referer" "https://spflashtool.com/download/" - ]; + url = "https://spflashtools.com/wp-content/uploads/SP_Flash_Tool_v5.2228_Linux.zip"; + hash = "sha256-GLEe7TQf1X/rf7xYp7jrk0KbrMfSWpk4eK+KC26Y3xA="; }; nativeBuildInputs = [ autoPatchelfHook makeWrapper - unrar + unzip ]; buildInputs = [ fontconfig @@ -47,14 +40,6 @@ stdenvNoCC.mkDerivation (self: { xorg.libXext xorg.libXrender ]; - unpackPhase = '' - runHook preUnpack - - unrar x -p${lib.escapeShellArg rarPassword} $src - cd */ - - runHook postUnpack - ''; # remove plugins that have outdated dependencies not available in nixpkgs # they are not needed to run the tool anyway prePatch = '' @@ -79,7 +64,7 @@ stdenvNoCC.mkDerivation (self: { ''; meta = { description = "Flash tool for MediaTek devices"; - homepage = "https://spflashtool.com/"; + homepage = "https://spflashtools.com/"; license = lib.licenses.unfree; maintainers = with lib.maintainers; [ amozeo ]; }; From a8da791356f0b84a5eff44a3d15724e44ab90e66 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 27 Feb 2025 23:34:46 +0100 Subject: [PATCH 154/218] {outputs; lib/gitignore-filer}: factor out gitignore filtering --- default.nix | 120 ++------------------------------------- lib/gitignore-filter.nix | 112 ++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 114 deletions(-) create mode 100644 lib/gitignore-filter.nix diff --git a/default.nix b/default.nix index 452a454..3dbc874 100644 --- a/default.nix +++ b/default.nix @@ -4,118 +4,10 @@ let # Ideally this file should be selfcontained, but I like the utilities in nixpkgs lib - lib = (import "${(import ./inputs.nix {}).nixpkgs}/lib"); - - # function that takes gitignore file pattern and returns filter function - # true - include file - # false - exclude file - # null - no match - # string -> string -> [(string -> string -> (bool | null))] - toGitignoreMatcher = gitignorePath: pattern: lib.pipe pattern [ - (v: { pattern = v; invalid = false; }) - # trim whitespaces not preceded by backslash - (v: v // { pattern = let - stringLength = builtins.stringLength v.pattern; - leftPaddingLength = builtins.stringLength (lib.trimWith { start = true; end = false; } v.pattern) - stringLength; - rightPaddingLength = builtins.stringLength (lib.trimWith { start = false; end = true; } v.pattern) - stringLength; - isLastCharBackslash = if stringLength == 0 then false - else builtins.substring (stringLength - rightPaddingLength - 1) 1 v.pattern == "\\"; - trimmedString = builtins.substring leftPaddingLength (stringLength - leftPaddingLength - rightPaddingLength) v.pattern; - in if isLastCharBackslash && rightPaddingLength > 0 then trimmedString + " " else trimmedString; }) - # ignore empty lines - (v: if v.pattern != "" then v else v // { invalid = true; }) - # ignore comments - (v: if !v.invalid && builtins.substring 0 1 v.pattern != "#" then v else v // { invalid = true; }) - # mark negated patterns - (v: - if !v.invalid && builtins.substring 0 1 v.pattern == "!" - then v // { - negated = true; - pattern = builtins.substring 1 (builtins.stringLength v) v; - } - else v // { negated = false; } - ) - # ignore escapes - (v: if v.invalid then v else v // { pattern = builtins.replaceStrings ["\\"] [""] v.pattern; }) - # convert parsed pattern to matchers - ({ pattern, negated, invalid }: { - __functor = _: path: type: let - relative = builtins.match "^/.+[^/]$" pattern == []; - directory = builtins.match "/$" pattern == []; - regexPattern = lib.pipe pattern [ - (v: if relative then "${gitignorePath}/${v}" else v) - (builtins.split "/") - (builtins.filter (v: v != [])) - (builtins.map (builtins.split "(\\*\\*|\\*)")) - (builtins.concatMap (v: - # v: (string | [string])[] - if v == [ "" ] then [] - # TODO: check and add support for .. if git supports - else if v == [ "." ] then [] - else [( builtins.foldl' (acc: vp: - # vp: string | [string] - if builtins.isString vp then acc + lib.escapeRegex vp - else if vp == [ "**" ] then acc + ".*" - else if vp == [ "*" ] then acc + "[^/]*" - else throw "unreachable" - ) "" v )] - )) - (builtins.concatStringsSep "/" ) - (v: if relative then v else ".*/${v}") - ]; - matches = (!directory || type == "directory") - && (builtins.match regexPattern path == []); - in if invalid then null - else if matches then negated - else null; - # for debug purposes - inherit pattern negated; - # for filtering purposes - inherit invalid; - }) - ]; - - # TODO: optimize this so if match is found in a given gitignore, - # no further checks in gitignores in parent directories are performed - - parseGitignore = gitRepositoryPath: filePath: lib.pipe filePath [ - (builtins.dirOf) - (builtins.split "/" ) - (builtins.filter (v: v != [] && v != "")) - # ["a" "b" "c"] -> ["/" "/a/" "/a/b/" "/a/b/c/"] - ( - builtins.foldl' (acc: v: acc ++ [( - (builtins.elemAt acc (builtins.length acc - 1)) + "${v}/" - )] ) ["/"] - ) - (builtins.map (v: "${v}.gitignore")) - # Filter out paths that are not part of git repository and don't exist - (builtins.filter (v: lib.hasPrefix gitRepositoryPath v && builtins.pathExists v)) - (builtins.map (v: { - path = v; - # Split gitignore files into lines - contents = lib.pipe v [ - builtins.readFile - (builtins.split "\n") - # builtins.split uses lists for matches - (builtins.filter (v: v != [])) - ]; - })) - # Convert gitignore patterns to matchers - (builtins.map (v: - builtins.map (toGitignoreMatcher v.path) v.contents) - ) - lib.flatten - (lib.filter (v: !v.invalid)) - ]; - - runGitignoreFilter = filters: path: type: lib.pipe filters [ - (builtins.map (v: v path type)) - (builtins.filter (v: v != null)) - # If any filter didn't match anything, include the file - (v: if v == [] then [ true ] else v) - (v: builtins.elemAt v (builtins.length v - 1)) - ]; + lib = (import "${(import ./inputs.nix {}).nixpkgs}/lib").extend (self: super: { + proot = import ./lib/gitignore-filter.nix { lib = self; }; + inherit (self.proot) parseGitignore runGitignoreFilter toGitignoreMatcher; + }); currentFilePath = (builtins.unsafeGetAttrPos "any" { any = "any"; }).file; storePathLength = builtins.stringLength (builtins.toString builtins.storeDir); @@ -124,11 +16,11 @@ let selfInStore = builtins.filterSource (path: type: let selfPath = builtins.dirOf currentFilePath; - gitIgnoreFilters = parseGitignore selfPath path; + gitIgnoreFilters = lib.parseGitignore selfPath path; result = type != "unknown" && type != "symlink" && builtins.baseNameOf path != ".git" - && runGitignoreFilter gitIgnoreFilters path type; + && lib.runGitignoreFilter gitIgnoreFilters path type; in result ) ./.; in diff --git a/lib/gitignore-filter.nix b/lib/gitignore-filter.nix new file mode 100644 index 0000000..42c8740 --- /dev/null +++ b/lib/gitignore-filter.nix @@ -0,0 +1,112 @@ +{ lib }: { + # function that takes gitignore file pattern and returns filter function + # true - include file + # false - exclude file + # null - no match + # string -> string -> [(string -> string -> (bool | null))] + toGitignoreMatcher = gitignorePath: pattern: lib.pipe pattern [ + (v: { pattern = v; invalid = false; }) + # trim whitespaces not preceded by backslash + (v: v // { pattern = let + stringLength = builtins.stringLength v.pattern; + leftPaddingLength = builtins.stringLength (lib.trimWith { start = true; end = false; } v.pattern) - stringLength; + rightPaddingLength = builtins.stringLength (lib.trimWith { start = false; end = true; } v.pattern) - stringLength; + isLastCharBackslash = if stringLength == 0 then false + else builtins.substring (stringLength - rightPaddingLength - 1) 1 v.pattern == "\\"; + trimmedString = builtins.substring leftPaddingLength (stringLength - leftPaddingLength - rightPaddingLength) v.pattern; + in if isLastCharBackslash && rightPaddingLength > 0 then trimmedString + " " else trimmedString; }) + # ignore empty lines + (v: if v.pattern != "" then v else v // { invalid = true; }) + # ignore comments + (v: if !v.invalid && builtins.substring 0 1 v.pattern != "#" then v else v // { invalid = true; }) + # mark negated patterns + (v: + if !v.invalid && builtins.substring 0 1 v.pattern == "!" + then v // { + negated = true; + pattern = builtins.substring 1 (builtins.stringLength v) v; + } + else v // { negated = false; } + ) + # ignore escapes + (v: if v.invalid then v else v // { pattern = builtins.replaceStrings ["\\"] [""] v.pattern; }) + # convert parsed pattern to matchers + ({ pattern, negated, invalid }: { + __functor = _: path: type: let + relative = builtins.match "^/.+[^/]$" pattern == []; + directory = builtins.match "/$" pattern == []; + regexPattern = lib.pipe pattern [ + (v: if relative then "${gitignorePath}/${v}" else v) + (builtins.split "/") + (builtins.filter (v: v != [])) + (builtins.map (builtins.split "(\\*\\*|\\*)")) + (builtins.concatMap (v: + # v: (string | [string])[] + if v == [ "" ] then [] + # TODO: check and add support for .. if git supports + else if v == [ "." ] then [] + else [( builtins.foldl' (acc: vp: + # vp: string | [string] + if builtins.isString vp then acc + lib.escapeRegex vp + else if vp == [ "**" ] then acc + ".*" + else if vp == [ "*" ] then acc + "[^/]*" + else throw "unreachable" + ) "" v )] + )) + (builtins.concatStringsSep "/" ) + (v: if relative then v else ".*/${v}") + ]; + matches = (!directory || type == "directory") + && (builtins.match regexPattern path == []); + in if invalid then null + else if matches then negated + else null; + # for debug purposes + inherit pattern negated; + # for filtering purposes + inherit invalid; + }) + ]; + + # TODO: optimize this so if match is found in a given gitignore, + # no further checks in gitignores in parent directories are performed + + parseGitignore = gitRepositoryPath: filePath: lib.pipe filePath [ + (builtins.dirOf) + (builtins.split "/" ) + (builtins.filter (v: v != [] && v != "")) + # ["a" "b" "c"] -> ["/" "/a/" "/a/b/" "/a/b/c/"] + ( + builtins.foldl' (acc: v: acc ++ [( + (builtins.elemAt acc (builtins.length acc - 1)) + "${v}/" + )] ) ["/"] + ) + (builtins.map (v: "${v}.gitignore")) + # Filter out paths that are not part of git repository and don't exist + (builtins.filter (v: lib.hasPrefix gitRepositoryPath v && builtins.pathExists v)) + (builtins.map (v: { + path = v; + # Split gitignore files into lines + contents = lib.pipe v [ + builtins.readFile + (builtins.split "\n") + # builtins.split uses lists for matches + (builtins.filter (v: v != [])) + ]; + })) + # Convert gitignore patterns to matchers + (builtins.map (v: + builtins.map (lib.toGitignoreMatcher v.path) v.contents) + ) + lib.flatten + (lib.filter (v: !v.invalid)) + ]; + + runGitignoreFilter = filters: path: type: lib.pipe filters [ + (builtins.map (v: v path type)) + (builtins.filter (v: v != null)) + # If any filter didn't match anything, include the file + (v: if v == [] then [ true ] else v) + (v: builtins.elemAt v (builtins.length v - 1)) + ]; +} From 278987461a367b3a4953badd788b9f449f097ee3 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 27 Feb 2025 23:38:38 +0100 Subject: [PATCH 155/218] default: set name for selfInStore --- default.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/default.nix b/default.nix index 3dbc874..d6c5e01 100644 --- a/default.nix +++ b/default.nix @@ -13,7 +13,10 @@ let storePathLength = builtins.stringLength (builtins.toString builtins.storeDir); evaluatingInStore = (builtins.substring 0 storePathLength currentFilePath) == builtins.storeDir; - selfInStore = builtins.filterSource (path: type: + selfInStore = builtins.path { + path = ./.; + name = "source"; + filter = path: type: let selfPath = builtins.dirOf currentFilePath; gitIgnoreFilters = lib.parseGitignore selfPath path; @@ -21,8 +24,8 @@ let && type != "symlink" && builtins.baseNameOf path != ".git" && lib.runGitignoreFilter gitIgnoreFilters path type; - in result - ) ./.; + in result; + }; in if !(evaluatingInStore) then { ... }@args: import selfInStore ({ selfPath = selfInStore; } // args ) else { ... }@args: import ./outputs.nix ({ selfPath = selfInStore; } // args) From b6f96bcbb9b9e82f051033be9de80a21985ab42a Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 6 Mar 2025 11:33:21 +0100 Subject: [PATCH 156/218] lock: update --- lock.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lock.nix b/lock.nix index 38ae8c7..19e928e 100644 --- a/lock.nix +++ b/lock.nix @@ -4,15 +4,15 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "5d7db4668d7a0c6cc5fc8cf6ef33b008b2b1ed8b"; - sha256 = "1xxfs0jk98236v3h7gwhhai7j33sri0phvgp5ng24x4lfvznwy71"; + revision = "6af28b834daca767a7ef99f8a7defa957d0ade6f"; + sha256 = "0afmlbvgky283wd2qjn7l19k1zzh454x6z97cdc22rnnzgfik1jv"; }; nixpkgs-unstable = { - revision = "5135c59491985879812717f4c9fea69604e7f26f"; - sha256 = "09qy7zv80bkd9ighsw0bdxjq70dw3qjnyvg7il1fycrsgs5x1gan"; + revision = "d69ab0d71b22fa1ce3dbeff666e6deb4917db049"; + sha256 = "078dp4099n4dygkyax8x828njahwry3zq23mvvwmmbzlzfm55dck"; }; cosmic-modules = { - revision = "c5a9b54c1ed6586e60ed6acd2178704ce1824c19"; - sha256 = "1wagkh8xkpq06nzwfy7jpjgr2wnigk15871jcvap3k3p4is3ykik"; + revision = "26677c041e1b4b8aa9126accf3797348c1975123"; + sha256 = "1zgr31l51ag4k6854x4rdx74kn2qfjn6f8swfcx0q07ds71d5a5y"; }; } From 57e722a5218da5c14f3ab20db9a62b356d21f03b Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 10 Mar 2025 02:53:54 +0100 Subject: [PATCH 157/218] hosts/tablet: use logind options instead of extraConfig --- hosts/tablet.nix | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hosts/tablet.nix b/hosts/tablet.nix index 949adb3..3ec9e20 100644 --- a/hosts/tablet.nix +++ b/hosts/tablet.nix @@ -42,15 +42,15 @@ rec { from = 1714; to = from + 50; } ]; - services.logind.extraConfig = '' - HandlePowerKey=suspend - HandlePowerKeyLongPress=poweroff - HandleSuspendKey=suspend-then-hibernate - HandleSuspendKeyLongPress=hibernate - HandleLidSwitch=lock - HandleLidSwitchDocked=ignore - HandleLidSwitchExternalPower=lock - ''; + services.logind = { + powerKey = "suspend"; + powerKeyLongPress = "poweroff"; + suspendKey = "suspend-then-hibernate"; + suspendKeyLongPress = "hibernate"; + lidSwitch = "lock"; + lidSwitchDocked = "ignore"; + lidSwitchExternalPower = "lock"; + }; system.stateVersion = "23.11"; }; From 6344181479505d9a0aebcc37f3ace0d070e9234f Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 12 Mar 2025 07:17:28 +0100 Subject: [PATCH 158/218] nixos/nvidia: update driver --- nix-os/nvidia.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nix-os/nvidia.nix b/nix-os/nvidia.nix index 835a87f..7bc76cf 100644 --- a/nix-os/nvidia.nix +++ b/nix-os/nvidia.nix @@ -16,12 +16,12 @@ open = false; nvidiaSettings = true; package = config.boot.kernelPackages.nvidiaPackages.mkDriver { - version = "570.86.16"; - sha256_64bit = "sha256-RWPqS7ZUJH9JEAWlfHLGdqrNlavhaR1xMyzs8lJhy9U="; - sha256_aarch64 = "sha256-RiO2njJ+z0DYBo/1DKa9GmAjFgZFfQ1/1Ga+vXG87vA="; - openSha256 = "sha256-DuVNA63+pJ8IB7Tw2gM4HbwlOh1bcDg2AN2mbEU9VPE="; - settingsSha256 = "sha256-9rtqh64TyhDF5fFAYiWl3oDHzKJqyOW3abpcf2iNRT8="; - persistencedSha256 = "sha256-3mp9X/oV8o2TH9720NnoXROxQ4g98nNee+DucXpQy3w="; + version = "570.124.04"; + sha256_64bit = "sha256-G3hqS3Ei18QhbFiuQAdoik93jBlsFI2RkWOBXuENU8Q="; + sha256_aarch64 = "sha256-HN58N00SNEwMQKSKuOMAXVW6J2VI/2YyDulQNJHuVeM="; + openSha256 = "sha256-KCGUyu/XtmgcBqJ8NLw/iXlaqB9/exg51KFx0Ta5ip0="; + settingsSha256 = "sha256-LNL0J/sYHD8vagkV1w8tb52gMtzj/F0QmJTV1cMaso8="; + persistencedSha256 = "sha256-SHSdnGyAiRH6e0gYMYKvlpRSH5KYlJSA1AJXPm7MDRk="; }; }; nixpkgs.config.nvidia.acceptLicense = true; From 5d5210546c839ed7f8cf0b30bc12c4ceb3fa1b08 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 12 Mar 2025 08:44:39 +0100 Subject: [PATCH 159/218] nixos/shell: add ripgrep --- nix-os/shell.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/shell.nix b/nix-os/shell.nix index e4a79d2..01f59ea 100644 --- a/nix-os/shell.nix +++ b/nix-os/shell.nix @@ -28,6 +28,7 @@ in environment.systemPackages = with pkgs; [ aliasDrag rangerGit + ripgrep kitty zoxide ]; From d6e2aad2ed53d8da8956ca2450090f7126644560 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 12 Mar 2025 23:55:01 +0100 Subject: [PATCH 160/218] Revert "nixos/nvidia: update driver" got some issuses with gpu on my main machine This reverts commit 6344181479505d9a0aebcc37f3ace0d070e9234f. --- nix-os/nvidia.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nix-os/nvidia.nix b/nix-os/nvidia.nix index 7bc76cf..835a87f 100644 --- a/nix-os/nvidia.nix +++ b/nix-os/nvidia.nix @@ -16,12 +16,12 @@ open = false; nvidiaSettings = true; package = config.boot.kernelPackages.nvidiaPackages.mkDriver { - version = "570.124.04"; - sha256_64bit = "sha256-G3hqS3Ei18QhbFiuQAdoik93jBlsFI2RkWOBXuENU8Q="; - sha256_aarch64 = "sha256-HN58N00SNEwMQKSKuOMAXVW6J2VI/2YyDulQNJHuVeM="; - openSha256 = "sha256-KCGUyu/XtmgcBqJ8NLw/iXlaqB9/exg51KFx0Ta5ip0="; - settingsSha256 = "sha256-LNL0J/sYHD8vagkV1w8tb52gMtzj/F0QmJTV1cMaso8="; - persistencedSha256 = "sha256-SHSdnGyAiRH6e0gYMYKvlpRSH5KYlJSA1AJXPm7MDRk="; + version = "570.86.16"; + sha256_64bit = "sha256-RWPqS7ZUJH9JEAWlfHLGdqrNlavhaR1xMyzs8lJhy9U="; + sha256_aarch64 = "sha256-RiO2njJ+z0DYBo/1DKa9GmAjFgZFfQ1/1Ga+vXG87vA="; + openSha256 = "sha256-DuVNA63+pJ8IB7Tw2gM4HbwlOh1bcDg2AN2mbEU9VPE="; + settingsSha256 = "sha256-9rtqh64TyhDF5fFAYiWl3oDHzKJqyOW3abpcf2iNRT8="; + persistencedSha256 = "sha256-3mp9X/oV8o2TH9720NnoXROxQ4g98nNee+DucXpQy3w="; }; }; nixpkgs.config.nvidia.acceptLicense = true; From 6b1ef18743bfac83cbf713a9acb1b15041c600d1 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 14 Mar 2025 08:17:16 +0100 Subject: [PATCH 161/218] lock: update --- lock.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lock.nix b/lock.nix index 19e928e..89eadf4 100644 --- a/lock.nix +++ b/lock.nix @@ -1,18 +1,18 @@ { nixos-vscode-server = { - revision = "fc900c16efc6a5ed972fb6be87df018bcf3035bc"; - sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; + revision = "8b6db451de46ecf9b4ab3d01ef76e59957ff549f"; + sha256 = "09j4kvsxw1d5dvnhbsgih0icbrxqv90nzf0b589rb5z6gnzwjnqf"; }; nixpkgs = { - revision = "6af28b834daca767a7ef99f8a7defa957d0ade6f"; - sha256 = "0afmlbvgky283wd2qjn7l19k1zzh454x6z97cdc22rnnzgfik1jv"; + revision = "cdd2ef009676ac92b715ff26630164bb88fec4e0"; + sha256 = "0r5c1l5cagxykyjfh1wsn8wk9vhay5dpwp36318hizn4rcrp9dm6"; }; nixpkgs-unstable = { - revision = "d69ab0d71b22fa1ce3dbeff666e6deb4917db049"; - sha256 = "078dp4099n4dygkyax8x828njahwry3zq23mvvwmmbzlzfm55dck"; + revision = "6607cf789e541e7873d40d3a8f7815ea92204f32"; + sha256 = "0lad6jan49sywk6xzgcivc4h3ln7grhjhb8q8jv2jwhwlgrfrxvh"; }; cosmic-modules = { - revision = "26677c041e1b4b8aa9126accf3797348c1975123"; - sha256 = "1zgr31l51ag4k6854x4rdx74kn2qfjn6f8swfcx0q07ds71d5a5y"; + revision = "24785e84d4b3844936caffe2c56994bdef9a9300"; + sha256 = "18qqbhw5kk5j2i741faamipbga590ywxkax19ny2nz3w2zfq64k4"; }; } From 17a8b2353cd21a69a984bc237ce9730043c70369 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 14 Mar 2025 08:18:18 +0100 Subject: [PATCH 162/218] lock: add comments where new revisions can be found --- lock.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lock.nix b/lock.nix index 89eadf4..7676e50 100644 --- a/lock.nix +++ b/lock.nix @@ -1,17 +1,23 @@ { nixos-vscode-server = { + # https://api.github.com/repos/nix-community/nixos-vscode-server/commits + # jsonpath: [1].sha revision = "8b6db451de46ecf9b4ab3d01ef76e59957ff549f"; sha256 = "09j4kvsxw1d5dvnhbsgih0icbrxqv90nzf0b589rb5z6gnzwjnqf"; }; nixpkgs = { + # https://channels.nixos.org/nixos-24.11/git-revision revision = "cdd2ef009676ac92b715ff26630164bb88fec4e0"; sha256 = "0r5c1l5cagxykyjfh1wsn8wk9vhay5dpwp36318hizn4rcrp9dm6"; }; nixpkgs-unstable = { + # https://channels.nixos.org/nixos-unstable/git-revision revision = "6607cf789e541e7873d40d3a8f7815ea92204f32"; sha256 = "0lad6jan49sywk6xzgcivc4h3ln7grhjhb8q8jv2jwhwlgrfrxvh"; }; cosmic-modules = { + # https://api.github.com/repos/lilyinstarlight/nixos-cosmic/commits + # jsonpath: [1].sha revision = "24785e84d4b3844936caffe2c56994bdef9a9300"; sha256 = "18qqbhw5kk5j2i741faamipbga590ywxkax19ny2nz3w2zfq64k4"; }; From 0cc888cb861977435bfd90989888a370ec30a343 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 15 Mar 2025 13:36:25 +0100 Subject: [PATCH 163/218] nixos/gnupg: use nixos modle options --- nix-os/gnupg.nix | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nix-os/gnupg.nix b/nix-os/gnupg.nix index 1c9b20e..48ad562 100644 --- a/nix-os/gnupg.nix +++ b/nix-os/gnupg.nix @@ -5,11 +5,15 @@ # Use pcscd for smartcard support services.pcscd.enable = true; - environment.systemPackages = [( - pkgs.gnupg.overrideAttrs (superAttrs: { + programs.gnupg = { + package = pkgs.gnupg.overrideAttrs (superAttrs: { configureFlags = superAttrs.configureFlags or [] ++ [ "--disable-ccid-driver" ]; - }) - )]; + }); + agent = { + enable = true; + pinentryPackage = pkgs.pinentry-qt; + }; + }; }; } From 567358418b3b876c4e966326501f1434b14e5989 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 16 Mar 2025 13:31:06 +0100 Subject: [PATCH 164/218] nixos/nix: wrap nix-env with log format bar --- nix-os/nix.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nix-os/nix.nix b/nix-os/nix.nix index a3c00db..5d17faa 100644 --- a/nix-os/nix.nix +++ b/nix-os/nix.nix @@ -19,6 +19,9 @@ let wrapProgram $out/bin/nix-shell \ --add-flags "--log-format" \ --add-flags "bar" + wrapProgram $out/bin/nix-env \ + --add-flags "--log-format" \ + --add-flags "bar" ''; }; From 3fb3b7771f93c1f3fcb077073f46fbbc3e02e157 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 17 Mar 2025 11:00:31 +0100 Subject: [PATCH 165/218] lock: update --- lock.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lock.nix b/lock.nix index 7676e50..434dd53 100644 --- a/lock.nix +++ b/lock.nix @@ -7,18 +7,18 @@ }; nixpkgs = { # https://channels.nixos.org/nixos-24.11/git-revision - revision = "cdd2ef009676ac92b715ff26630164bb88fec4e0"; - sha256 = "0r5c1l5cagxykyjfh1wsn8wk9vhay5dpwp36318hizn4rcrp9dm6"; + revision = "a1185f4064c18a5db37c5c84e5638c78b46e3341"; + sha256 = "0ipjb56fdhfvhgnrw0rvp89g0mplpyhjil29fqdcpmv4ablbadqc"; }; nixpkgs-unstable = { # https://channels.nixos.org/nixos-unstable/git-revision - revision = "6607cf789e541e7873d40d3a8f7815ea92204f32"; - sha256 = "0lad6jan49sywk6xzgcivc4h3ln7grhjhb8q8jv2jwhwlgrfrxvh"; + revision = "c80f6a7e10b39afcc1894e02ef785b1ad0b0d7e5"; + sha256 = "1sfb9g6fmyfligcsd1rmkamfqvy8kgn3p0sy8ickf6swi1zdbf0b"; }; cosmic-modules = { # https://api.github.com/repos/lilyinstarlight/nixos-cosmic/commits # jsonpath: [1].sha - revision = "24785e84d4b3844936caffe2c56994bdef9a9300"; - sha256 = "18qqbhw5kk5j2i741faamipbga590ywxkax19ny2nz3w2zfq64k4"; + revision = "fcee247f21d21acb738ac208d6ed86e65c2e7240"; + sha256 = "18xw0innlpswz35cf8n16myh5a24b4kpw0xckwm42c93zd5rm2zh"; }; } From 7ec22b6e5204cdfe60f47874429deabf817e1dc2 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 18 Mar 2025 18:09:26 +0100 Subject: [PATCH 166/218] pkgs/den-update-script: init --- pkgs/by-name/de/den-update-script/package.nix | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 pkgs/by-name/de/den-update-script/package.nix diff --git a/pkgs/by-name/de/den-update-script/package.nix b/pkgs/by-name/de/den-update-script/package.nix new file mode 100644 index 0000000..662e3ce --- /dev/null +++ b/pkgs/by-name/de/den-update-script/package.nix @@ -0,0 +1,39 @@ +{ + lib, + path, + + overlayAttrname ? "den-outputs", +}: + +assert lib.assertMsg (!lib.hasInfix "." overlayAttrname) (lib.pipe '' + overlayAttrname must not contain a dot (.), + because dot is used to reference package in a package set + inside nix-update-script. +'' [ + lib.lines + (lib.concatStringsSep " ") +]); + +let + updateScript = import (path + /maintainers/scripts/update.nix); + functionArgs = lib.functionArgs updateScript; + nameInFunctionArgs = name: lib.elem name (lib.attrNames functionArgs); +in +{ + __functionArgs = functionArgs // { packages = false; }; + __functor = _: args: let + # args.outputs should be an attrset of packages to update + overlay = _: _: { + "${overlayAttrname}" = args.packages; + }; + in updateScript (lib.filterAttrs (name: _: nameInFunctionArgs name) args // { + include-overlays = + if !args ? updateScript then [ overlay ] + else if lib.isList args.updateScript then [ overlay ] ++ args.updateScript + else args.updateScript; + } // lib.optionalAttrs (args ? package) { + package = "${overlayAttrname}.${args.package}"; + } // lib.optionalAttrs (args ? path) { + path = if lib.stringLength args.path == 0 then overlayAttrname else "${overlayAttrname}.${args.path}"; + }); +} From ec12c3eee43086994421d7b7f2b74f6122bf383b Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 18 Mar 2025 18:10:01 +0100 Subject: [PATCH 167/218] pkgs/den-http-get-updater: init --- .../de/den-http-get-updater/package.nix | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 pkgs/by-name/de/den-http-get-updater/package.nix diff --git a/pkgs/by-name/de/den-http-get-updater/package.nix b/pkgs/by-name/de/den-http-get-updater/package.nix new file mode 100644 index 0000000..d22b0ac --- /dev/null +++ b/pkgs/by-name/de/den-http-get-updater/package.nix @@ -0,0 +1,106 @@ +{ + lib, + + curl, + gawk, + jq, + nix, + writeScript, +}: + +{ + # location of file to modify + fileLocation, + previousHash, + previousVersion, + versionUrl, + prefetchUrlLocation ? null, + # change newVersion variable in it, if the contents of the page + # is not plaintext version + # (json for example) + contentParser ? "echo \"$newVersion\"", + + unpack ? true, + name ? if unpack then "source" else null, +}: + +assert builtins.isNull prefetchUrlLocation || lib.isAttrs prefetchUrlLocation; +assert lib.isAttrs prefetchUrlLocation && ( + lib.isString prefetchUrlLocation.file or null || + lib.isPath prefetchUrlLocation.file or null +); +assert lib.isAttrs prefetchUrlLocation && lib.isString prefetchUrlLocation.attrpath or null; + +let + realFileLocation = builtins.toString fileLocation; + mark = builtins.hashString "sha256" previousHash; + + mark' = lib.escapeShellArg mark; + prefetchUrlLocation' = lib.mapAttrs (_: lib.escapeShellArg) prefetchUrlLocation; + realFileLocation' = lib.escapeShellArg realFileLocation; + versionUrl' = lib.escapeShellArg versionUrl; + + mark'' = lib.escapeShellArg (lib.escapeRegex mark); + previousVersion'' = lib.escapeShellArg (lib.escapeRegex previousVersion); + + nixUnpack = lib.optionalString unpack "--unpack"; + nixName = lib.optionalString (!builtins.isNull name) "--name \"${lib.escapeShellArg name}\""; + + path = lib.makeBinPath [ + curl + gawk + jq + nix + ]; +in + +writeScript "den-http-get-updater" ('' + PATH="${lib.escapeShellArg path}" + + newVersion=$(curl -L "${versionUrl'}") + if [[ "$?" != 0 ]]; then + echo "error: fetching new version failed" 1>&2 + exit 1 + fi + newVersion=$(${contentParser}) + awk -i inplace "{ + sub(/${previousVersion''}/, \"$newVersion\") + # invalidate hash + sub(/${previousHash}/, \"${mark'}\") + }1" "${realFileLocation'}" +'' + lib.optionalString (!builtins.isNull prefetchUrlLocation) '' + nixUrlsResult=$(nix-instantiate --eval --json \ + "${prefetchUrlLocation'.file}" \ + -A "${prefetchUrlLocation'.attrpath}" + ) + + urlsType=$(jq -rc 'type' <<< "$nixUrlsResult") + if [ "$urlsType" = "array" ]; then + readarray -t prefetchUrls < <( + jq -rc '.[]' <<< "$nixUrlsResult" + ) + elif [ "$urlsType" = "string" ]; then + readarray -t prefetchUrls < <( + jq -rc '.' <<< "$nixUrlsResult" + ) + fi + + prefetchSucceeded=1 + for url in "''${prefetchUrls[@]}"; do + echo "trying prefetch '$url'..."; + expectedHash=$(nix-prefetch-url "$url" ${nixUnpack} ${nixName}) + if [[ -n $expectedHash ]]; then + echo "prefetch succeeded!" + echo "hash: $expectedHash" + awk -i inplace "{ + sub(/${mark''}/, \"$expectedHash\") + }1" "${realFileLocation'}" + prefetchSucceeded= + break + fi + done + if [[ -n "$prefetchSucceeded" ]]; then + echo "warning: prefetch failed" 1>&2 + exit 1 + fi +'') From 476cf36b572eb1488eac2ee120ff286d38be0593 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 18 Mar 2025 18:11:09 +0100 Subject: [PATCH 168/218] inputs: provide updateScripts --- inputs.nix | 83 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 14 deletions(-) diff --git a/inputs.nix b/inputs.nix index 1979433..1c6c039 100644 --- a/inputs.nix +++ b/inputs.nix @@ -1,29 +1,84 @@ let self = { - lock ? import ./lock.nix -, lib ? import "${(self {}).nixpkgs}/lib" + lock ? import lockFile, + lockFile ? ./lock.nix, + pkgs ? throw "inputs called without pkgs", }: { inherit lock; - nixos-vscode-server = builtins.fetchTarball { - name = "nixos-vscode-server"; + nixos-vscode-server = rec { url = "https://github.com/nix-community/nixos-vscode-server/archive/${lock.nixos-vscode-server.revision}.tar.gz"; - sha256 = "${lock.nixos-vscode-server.sha256}"; + updateScript = pkgs.den-http-get-updater { + fileLocation = lockFile; + previousHash = lock.nixos-vscode-server.sha256; + previousVersion = lock.nixos-vscode-server.revision; + versionUrl = "https://api.github.com/repos/nix-community/nixos-vscode-server/commits"; + contentParser = "jq -rc '.[0].sha' <<< \"$newVersion\""; + prefetchUrlLocation = { + file = ./inputs.nix; + attrpath = "nixos-vscode-server.url"; + }; + }; + outPath = builtins.fetchTarball { + inherit url; + name = "nixos-vscode-server"; + sha256 = "${lock.nixos-vscode-server.sha256}"; + }; }; - nixpkgs = builtins.fetchTarball { - name = "nixpkgs"; + nixpkgs = rec { url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs.revision}.tar.gz"; - sha256 = "${lock.nixpkgs.sha256}"; + updateScript = pkgs.den-http-get-updater { + fileLocation = lockFile; + previousHash = lock.nixpkgs.sha256; + previousVersion = lock.nixpkgs.revision; + versionUrl = "https://channels.nixos.org/nixos-24.11/git-revision"; + prefetchUrlLocation = { + file = ./inputs.nix; + attrpath = "nixpkgs.url"; + }; + }; + outPath = builtins.fetchTarball { + inherit url; + name = "nixpkgs"; + sha256 = "${lock.nixpkgs.sha256}"; + }; }; - nixpkgs-unstable = builtins.fetchTarball { - name = "nixpkgs-unstable"; + nixpkgs-unstable = rec { url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs-unstable.revision}.tar.gz"; - sha256 = "${lock.nixpkgs-unstable.sha256}"; + updateScript = pkgs.den-http-get-updater { + fileLocation = lockFile; + previousHash = lock.nixpkgs-unstable.sha256; + previousVersion = lock.nixpkgs-unstable.revision; + versionUrl = "https://channels.nixos.org/nixos-unstable/git-revision"; + prefetchUrlLocation = { + file = ./inputs.nix; + attrpath = "nixpkgs-unstable.url"; + }; + }; + outPath = builtins.fetchTarball { + inherit url; + name = "nixpkgs-unstable"; + sha256 = "${lock.nixpkgs-unstable.sha256}"; + }; }; - cosmic-modules = builtins.fetchTarball { - name = "cosmic-modules"; + cosmic-modules = rec { url = "https://github.com/lilyinstarlight/nixos-cosmic/archive/${lock.cosmic-modules.revision}.tar.gz"; - sha256 = "${lock.cosmic-modules.sha256}"; + updateScript = pkgs.den-http-get-updater { + fileLocation = lockFile; + previousHash = lock.cosmic-modules.sha256; + previousVersion = lock.cosmic-modules.revision; + versionUrl = "https://api.github.com/repos/lilyinstarlight/nixos-cosmic/commits"; + contentParser = "jq -rc '.[0].sha' <<< \"$newVersion\""; + prefetchUrlLocation = { + file = ./inputs.nix; + attrpath = "cosmic-modules.url"; + }; + }; + outPath = builtins.fetchTarball { + inherit url; + name = "cosmic-modules"; + sha256 = "${lock.cosmic-modules.sha256}"; + }; }; }; in self From 59d6ba8f9715ced6fd777825a91b0713f57c884c Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 18 Mar 2025 18:13:17 +0100 Subject: [PATCH 169/218] update-list: create this nix file will store all updaters availabe in my nix dotfiles --- update-list.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 update-list.nix diff --git a/update-list.nix b/update-list.nix new file mode 100644 index 0000000..9ce74c3 --- /dev/null +++ b/update-list.nix @@ -0,0 +1,13 @@ +self: + +# MARK: inputs +( let + inputsWithPackages = import self.inputsPath { + pkgs = self.packagesForSystem builtins.currentSystem; + }; +in { + "inputs/nixpkgs" = inputsWithPackages.nixpkgs; + "inputs/nixpkgs-unstable" = inputsWithPackages.nixpkgs-unstable; + "inputs/cosmic-modules" = inputsWithPackages.cosmic-modules; + "inputs/nixos-vscode-server" = inputsWithPackages.nixos-vscode-server; +}) From 72d18c49feed6e974f6c44855b0072c1b1194bf0 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 18 Mar 2025 18:14:12 +0100 Subject: [PATCH 170/218] outputs: add updater script --- outputs.nix | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/outputs.nix b/outputs.nix index adc23e6..76b8b85 100644 --- a/outputs.nix +++ b/outputs.nix @@ -1,5 +1,6 @@ { - inputs ? import ./inputs.nix {}, + inputsPath ? ./inputs.nix, + inputs ? import inputsPath {}, selfPath ? ./. }: @@ -16,7 +17,7 @@ systems = [ forEachSystem = lib.genAttrs systems; self = { - inherit inputs lib self; + inherit inputs inputsPath lib self; outPath = selfPath; modifiedNixpkgs = import ./pkgs/top-level/impure.nix; modifiedNixpkgsPure = import ./pkgs/top-level/default.nix; @@ -71,6 +72,30 @@ self = { builtins.attrValues builtins.listToAttrs ]; + # FIXME: currently impure + # NOTE: to run, you need to evaluate outputs.nix instead of default.nix + # nix-shell outputs.nix -A update + update = let + updateScript = (self.packagesForSystem (builtins.currentSystem)).den-update-script; + in updateScript { + path = ""; + packages = lib.pipe ./update-list.nix [ + import + (x: x self) + lib.attrsToList + (lib.imap1 (i: {name, value}: { + name = builtins.toString i; + value = value // { + # hack to pass isDerivation check in nixpkgs maintainers/scripts/update.nix + # https://github.com/NixOS/nixpkgs/blob/a1185f4064c18a5db37c5c84e5638c78b46e3341/maintainers/scripts/update.nix#L85 + type = "derivation"; + name = name; + }; + })) + builtins.listToAttrs + lib.recurseIntoAttrs + ]; + }; }; in self From a3f4302bfbced08ac3006e397c64236e1e4d20a3 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 18 Mar 2025 18:19:31 +0100 Subject: [PATCH 171/218] Revert "lock: add comments where new revisions can be found" This reverts commit 17a8b2353cd21a69a984bc237ce9730043c70369. --- lock.nix | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lock.nix b/lock.nix index 434dd53..74519cc 100644 --- a/lock.nix +++ b/lock.nix @@ -1,23 +1,17 @@ { nixos-vscode-server = { - # https://api.github.com/repos/nix-community/nixos-vscode-server/commits - # jsonpath: [1].sha revision = "8b6db451de46ecf9b4ab3d01ef76e59957ff549f"; sha256 = "09j4kvsxw1d5dvnhbsgih0icbrxqv90nzf0b589rb5z6gnzwjnqf"; }; nixpkgs = { - # https://channels.nixos.org/nixos-24.11/git-revision revision = "a1185f4064c18a5db37c5c84e5638c78b46e3341"; sha256 = "0ipjb56fdhfvhgnrw0rvp89g0mplpyhjil29fqdcpmv4ablbadqc"; }; nixpkgs-unstable = { - # https://channels.nixos.org/nixos-unstable/git-revision revision = "c80f6a7e10b39afcc1894e02ef785b1ad0b0d7e5"; sha256 = "1sfb9g6fmyfligcsd1rmkamfqvy8kgn3p0sy8ickf6swi1zdbf0b"; }; cosmic-modules = { - # https://api.github.com/repos/lilyinstarlight/nixos-cosmic/commits - # jsonpath: [1].sha revision = "fcee247f21d21acb738ac208d6ed86e65c2e7240"; sha256 = "18xw0innlpswz35cf8n16myh5a24b4kpw0xckwm42c93zd5rm2zh"; }; From 5a0008e2d920461bcc7c637320f68a3f0b89b2e4 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 18 Mar 2025 18:49:10 +0100 Subject: [PATCH 172/218] nixos/nix: wrap nix once --- nix-os/nix.nix | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/nix-os/nix.nix b/nix-os/nix.nix index 5d17faa..de9687f 100644 --- a/nix-os/nix.nix +++ b/nix-os/nix.nix @@ -23,6 +23,9 @@ let --add-flags "--log-format" \ --add-flags "bar" ''; + passthru = { + inherit (pkgs.nix) man meta version; + }; }; wrappedNixosExecutables = pkgs.symlinkJoin { @@ -37,18 +40,9 @@ let --add-flags "bar" ''; }; - - - wrappedNix = (pkgs.symlinkJoin { - name = "wrappedNix-${pkgs.nix.version}"; - paths = [ pkgs.nix ] ++ [( wrappedNixExecutables false )]; - }).overrideAttrs { - version = pkgs.nix.version; - passthru.meta = pkgs.nix.meta; - }; in { config = { - nix.package = wrappedNix; + nix.package = wrappedNixExecutables false; environment.systemPackages = lib.map (lib.hiPrio) [ (wrappedNixExecutables true) wrappedNixosExecutables From 0b028df8a3c26191b99865caf1dd4fcab57f24f0 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 22 Mar 2025 15:23:36 +0100 Subject: [PATCH 173/218] lock: update --- lock.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lock.nix b/lock.nix index 74519cc..a1a5a65 100644 --- a/lock.nix +++ b/lock.nix @@ -4,15 +4,15 @@ sha256 = "09j4kvsxw1d5dvnhbsgih0icbrxqv90nzf0b589rb5z6gnzwjnqf"; }; nixpkgs = { - revision = "a1185f4064c18a5db37c5c84e5638c78b46e3341"; - sha256 = "0ipjb56fdhfvhgnrw0rvp89g0mplpyhjil29fqdcpmv4ablbadqc"; + revision = "7105ae3957700a9646cc4b766f5815b23ed0c682"; + sha256 = "0j3jd82iyyck4hpmz7pkak1v27l7pydl0c3vvyz6wfpi612x8xzi"; }; nixpkgs-unstable = { - revision = "c80f6a7e10b39afcc1894e02ef785b1ad0b0d7e5"; - sha256 = "1sfb9g6fmyfligcsd1rmkamfqvy8kgn3p0sy8ickf6swi1zdbf0b"; + revision = "a84ebe20c6bc2ecbcfb000a50776219f48d134cc"; + sha256 = "053xxy1bn35d9088h3rznhqkqq7lnnhn4ahrilwik8l4b6k8inlq"; }; cosmic-modules = { - revision = "fcee247f21d21acb738ac208d6ed86e65c2e7240"; - sha256 = "18xw0innlpswz35cf8n16myh5a24b4kpw0xckwm42c93zd5rm2zh"; + revision = "216557e6cd229dbe7d73a497c227824a3c579cd7"; + sha256 = "1m9hfmkrsgzf2jwjymlxvi8r01n1ng48z3wr9478ywn9bdp7r0w6"; }; } From 6de65850fe216699c280a53c7a558ae2798edbf2 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 23 Mar 2025 13:30:34 +0100 Subject: [PATCH 174/218] nixos/nix: use nixos-rebuild from nixpkgs/389487 --- nix-os/nix.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/nix-os/nix.nix b/nix-os/nix.nix index de9687f..d536156 100644 --- a/nix-os/nix.nix +++ b/nix-os/nix.nix @@ -28,9 +28,18 @@ let }; }; + # nixpkgs PR389487 + # https://github.com/NixOS/nixpkgs/pull/389487 + futureNixosExecutables = let + nixpkgs = builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/e8f4dba5135ce202c7ef77118f145ef8b3803088.tar.gz"; + sha256 = "1ssqca6x9g6ys754zj2sdvsi85hwfhqd04pa445gavr4wiadgv0b"; + }; + in pkgs.callPackage "${nixpkgs}/pkgs/os-specific/linux/nixos-rebuild/default.nix" {}; + wrappedNixosExecutables = pkgs.symlinkJoin { name = "${pkgs.nixos-rebuild.name}-wrap"; - paths = [ pkgs.nixos-rebuild ]; + paths = [ futureNixosExecutables ]; nativeBuildInputs = [ pkgs.makeWrapper ]; @@ -47,5 +56,6 @@ in { (wrappedNixExecutables true) wrappedNixosExecutables ]; + system.tools.nixos-rebuild.enable = false; }; } From 702a9c9759871614dee7ecf55de85bfdd71e1658 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 23 Mar 2025 13:31:21 +0100 Subject: [PATCH 175/218] core: add nixos-system NIX_PATH --- nix-os/core.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/core.nix b/nix-os/core.nix index 39ae485..34c6f41 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -29,6 +29,7 @@ "systemNixpkgs=${pkgs.selfExpr { useConfig = true; name = "systemNixpkgs-self"; }}" # don't garbage collect the nixpkgs input "inputsNixpkgs=${inputs.nixpkgs}" + "nixos-system=/etc/nixos/default.nix" ]; }; From ec643a6870ebc94888324d04a95476427695a7e2 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 29 Mar 2025 13:23:22 +0100 Subject: [PATCH 176/218] lock: update --- lock.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lock.nix b/lock.nix index a1a5a65..a18318a 100644 --- a/lock.nix +++ b/lock.nix @@ -4,15 +4,15 @@ sha256 = "09j4kvsxw1d5dvnhbsgih0icbrxqv90nzf0b589rb5z6gnzwjnqf"; }; nixpkgs = { - revision = "7105ae3957700a9646cc4b766f5815b23ed0c682"; - sha256 = "0j3jd82iyyck4hpmz7pkak1v27l7pydl0c3vvyz6wfpi612x8xzi"; + revision = "d02d88f8de5b882ccdde0465d8fa2db3aa1169f7"; + sha256 = "0hdb0ajwfl7xn1hznik4kj35adiksc8k5apllz3jniwrszpkwrwm"; }; nixpkgs-unstable = { - revision = "a84ebe20c6bc2ecbcfb000a50776219f48d134cc"; - sha256 = "053xxy1bn35d9088h3rznhqkqq7lnnhn4ahrilwik8l4b6k8inlq"; + revision = "5e5402ecbcb27af32284d4a62553c019a3a49ea6"; + sha256 = "0a8xv91nz7qkyxs3nhszxj3vb9s5v1xgyhmm32y1fbb8njx7hrw1"; }; cosmic-modules = { - revision = "216557e6cd229dbe7d73a497c227824a3c579cd7"; - sha256 = "1m9hfmkrsgzf2jwjymlxvi8r01n1ng48z3wr9478ywn9bdp7r0w6"; + revision = "c709db4b95e58f410978bb49c87cb74214d03e78"; + sha256 = "1szkgpsvm3yrdsg1rm0rr9yagcy8ynakvymlcw43c0736980bcba"; }; } From bf1bc73824424c2f7423df5ff6ee0cba24a2c8ee Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 29 Mar 2025 13:23:35 +0100 Subject: [PATCH 177/218] nixos/nvidia: update --- nix-os/nvidia.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nix-os/nvidia.nix b/nix-os/nvidia.nix index 835a87f..2c10f15 100644 --- a/nix-os/nvidia.nix +++ b/nix-os/nvidia.nix @@ -16,12 +16,12 @@ open = false; nvidiaSettings = true; package = config.boot.kernelPackages.nvidiaPackages.mkDriver { - version = "570.86.16"; - sha256_64bit = "sha256-RWPqS7ZUJH9JEAWlfHLGdqrNlavhaR1xMyzs8lJhy9U="; - sha256_aarch64 = "sha256-RiO2njJ+z0DYBo/1DKa9GmAjFgZFfQ1/1Ga+vXG87vA="; - openSha256 = "sha256-DuVNA63+pJ8IB7Tw2gM4HbwlOh1bcDg2AN2mbEU9VPE="; - settingsSha256 = "sha256-9rtqh64TyhDF5fFAYiWl3oDHzKJqyOW3abpcf2iNRT8="; - persistencedSha256 = "sha256-3mp9X/oV8o2TH9720NnoXROxQ4g98nNee+DucXpQy3w="; + version = "570.133.07"; + sha256_64bit = "sha256-LUPmTFgb5e9VTemIixqpADfvbUX1QoTT2dztwI3E3CY="; + sha256_aarch64 = "sha256-yTovUno/1TkakemRlNpNB91U+V04ACTMwPEhDok7jI0="; + openSha256 = "sha256-9l8N83Spj0MccA8+8R1uqiXBS0Ag4JrLPjrU3TaXHnM="; + settingsSha256 = "sha256-XMk+FvTlGpMquM8aE8kgYK2PIEszUZD2+Zmj2OpYrzU="; + persistencedSha256 = "sha256-G1V7JtHQbfnSRfVjz/LE2fYTlh9okpCbE4dfX9oYSg8="; }; }; nixpkgs.config.nvidia.acceptLicense = true; From 162c32d8fe2af23fe3a0bdad541bf2e2b5bbce0d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 29 Mar 2025 13:23:59 +0100 Subject: [PATCH 178/218] razer: use newer version --- nix-os/razer.nix | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/nix-os/razer.nix b/nix-os/razer.nix index cd9dcf1..9bb2dac 100644 --- a/nix-os/razer.nix +++ b/nix-os/razer.nix @@ -1,10 +1,44 @@ -{ lib, config, pkgs, ... }: { + config, + lib, + modulesPath, + pkgs, + ... +}: + +{ + # NIXPKGS-PR: 394300 + disabledModules = [ + "${modulesPath}/hardware/openrazer.nix" + ]; + imports = [ + (builtins.fetchurl { + url = "https://raw.githubusercontent.com/NixOS/nixpkgs/4a11562c20fbe7af7d5ac139dbf0f8d50ce276f6/nixos/modules/hardware/openrazer.nix"; + sha256 = "0n6kzrcwlmxgws4pmffyqagp2rxpfxmfjl11vgvlkjcbglg6fs7y"; + }) + ]; + hardware.openrazer = { enable = true; users = [ "wroclaw" ]; + # NIXPKGS-PR: 384992 + packages = let + oldVersion = pkgs.python3Packages.openrazer-daemon.version; + version = "3.10.1"; + in lib.mapAttrs (_: package: package.overrideAttrs (oldAttrs: { + version = lib.replaceStrings [ oldVersion ] [ version ] oldAttrs.version; + src = pkgs.fetchFromGitHub { + owner = "openrazer"; + repo = "openrazer"; + tag = "v${version}"; + hash = "sha256-igrGx7Y6ENtZatJCTAW43/0q6ZjljJ9/kU3QFli4yIU="; + }; + })) { + kernel = config.boot.kernelPackages.openrazer; + daemon = pkgs.python3Packages.openrazer-daemon; + }; }; # users.groups.openrazer.members = [ # "wroclaw" From f3fb4bb3b370d6ad1058f77b6cbb63d89f5c90c8 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 29 Mar 2025 13:24:59 +0100 Subject: [PATCH 179/218] nixos/razer: remove unnecesary comment and package --- nix-os/razer.nix | 4 ---- 1 file changed, 4 deletions(-) diff --git a/nix-os/razer.nix b/nix-os/razer.nix index 9bb2dac..f1df5ff 100644 --- a/nix-os/razer.nix +++ b/nix-os/razer.nix @@ -40,11 +40,7 @@ daemon = pkgs.python3Packages.openrazer-daemon; }; }; -# users.groups.openrazer.members = [ -# "wroclaw" -# ]; environment.systemPackages = with pkgs; [ - openrazer-daemon polychromatic ]; } From f2407664c11004caa27929bd0223c32f4eb3c2c6 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 29 Mar 2025 13:43:24 +0100 Subject: [PATCH 180/218] nixos/nix: use proper nixos-rebuild for its reexec --- nix-os/nix.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/nix.nix b/nix-os/nix.nix index d536156..78d8586 100644 --- a/nix-os/nix.nix +++ b/nix-os/nix.nix @@ -56,6 +56,7 @@ in { (wrappedNixExecutables true) wrappedNixosExecutables ]; + system.build.nixos-rebuild = lib.mkForce wrappedNixosExecutables; system.tools.nixos-rebuild.enable = false; }; } From e3264f14511a1f22ec2ae05cee7c7de6f1ef3fe0 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 1 Apr 2025 00:57:46 +0200 Subject: [PATCH 181/218] pkgs/by-name-overlay: use lib from super instead of outputs.nix --- pkgs/top-level/by-name-overlay.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/top-level/by-name-overlay.nix b/pkgs/top-level/by-name-overlay.nix index ed63216..132c299 100644 --- a/pkgs/top-level/by-name-overlay.nix +++ b/pkgs/top-level/by-name-overlay.nix @@ -6,8 +6,9 @@ # Type: Path -> Overlay baseDirectory: +self: super: let - lib = (import ../../outputs.nix {}).lib; + lib = super.lib; inherit (builtins) readDir @@ -39,9 +40,7 @@ let # Filter out paths that don't have a ${nixFilename} file (lib.filterAttrs (_: lib.pathExists)) ]; -in -self: super: -mapAttrs (name: file: +in mapAttrs (name: file: self.callPackage file { inherit self super; package = super.${name}; } ) (packageFiles "override.nix") // mapAttrs (name: file: From 00cbc505f33b9e7471936ccdf1da0012c9f09508 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 1 Apr 2025 15:37:03 +0200 Subject: [PATCH 182/218] hosts: define hostPlatform in defined systems instead of getting them impurely from `builtins.currentSystem` --- hosts/main/default.nix | 2 ++ hosts/tablet.nix | 2 ++ hosts/vm-base.nix | 1 + outputs.nix | 1 + 4 files changed, 6 insertions(+) diff --git a/hosts/main/default.nix b/hosts/main/default.nix index 75d7df7..3b9807f 100644 --- a/hosts/main/default.nix +++ b/hosts/main/default.nix @@ -83,6 +83,8 @@ OLLAMA_HOST = "127.0.0.1:${builtins.toString config.services.ollama.port}"; }; + nixpkgs.hostPlatform = "x86_64-linux"; + system.stateVersion = "23.05"; }; } diff --git a/hosts/tablet.nix b/hosts/tablet.nix index 3ec9e20..7343cda 100644 --- a/hosts/tablet.nix +++ b/hosts/tablet.nix @@ -52,6 +52,8 @@ lidSwitchExternalPower = "lock"; }; + nixpkgs.hostPlatform = "x86_64-linux"; + system.stateVersion = "23.11"; }; } diff --git a/hosts/vm-base.nix b/hosts/vm-base.nix index 9c7a57a..8584fbd 100644 --- a/hosts/vm-base.nix +++ b/hosts/vm-base.nix @@ -20,5 +20,6 @@ virtualisation.forwardPorts = [ { from = "host"; host.port = 2222; guest.port = 22; } ]; + nixpkgs.hostPlatform = "x86_64-linux"; }; } diff --git a/outputs.nix b/outputs.nix index 76b8b85..48ad9b6 100644 --- a/outputs.nix +++ b/outputs.nix @@ -38,6 +38,7 @@ self = { nixosSystem = import "${inputs.nixpkgs}/nixos/lib/eval-config.nix"; mkNixosSystem = path: nixosSystem { inherit lib; + system = null; modules = [ path { From 1e9d55517d64dbc0ad4ccfe248c1ec44df5b0947 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 1 Apr 2025 16:35:56 +0200 Subject: [PATCH 183/218] pkgs/top-level: properly get inputs --- pkgs/top-level/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index 34637da..9194e56 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -1,4 +1,4 @@ -{ inputs ? import ../../inputs.nix {} +{ inputs ? (import ../../. {}).inputs , uninitializedNixpkgs ? import "${inputs.nixpkgs}/pkgs/top-level/default.nix" , ... } @ args: From fb87b9fafbfc27ca8ce603f11d8b8ea16890fc9d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 4 Apr 2025 08:45:52 +0200 Subject: [PATCH 184/218] lock: update --- lock.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lock.nix b/lock.nix index a18318a..a6993db 100644 --- a/lock.nix +++ b/lock.nix @@ -4,15 +4,15 @@ sha256 = "09j4kvsxw1d5dvnhbsgih0icbrxqv90nzf0b589rb5z6gnzwjnqf"; }; nixpkgs = { - revision = "d02d88f8de5b882ccdde0465d8fa2db3aa1169f7"; - sha256 = "0hdb0ajwfl7xn1hznik4kj35adiksc8k5apllz3jniwrszpkwrwm"; + revision = "44a69ed688786e98a101f02b712c313f1ade37ab"; + sha256 = "19q0mqqzab5n7q5smw4yryplz52n838k11afdir49db73d8qly5x"; }; nixpkgs-unstable = { - revision = "5e5402ecbcb27af32284d4a62553c019a3a49ea6"; - sha256 = "0a8xv91nz7qkyxs3nhszxj3vb9s5v1xgyhmm32y1fbb8njx7hrw1"; + revision = "2c8d3f48d33929642c1c12cd243df4cc7d2ce434"; + sha256 = "0lbn29dn647kgf3g3nzch8an3m0gn2ysrmq8l7q6lzc8lgwgif8p"; }; cosmic-modules = { - revision = "c709db4b95e58f410978bb49c87cb74214d03e78"; - sha256 = "1szkgpsvm3yrdsg1rm0rr9yagcy8ynakvymlcw43c0736980bcba"; + revision = "b91eebbf1f88bc817bab333e278da7119d3db01b"; + sha256 = "1fjrwvdzfiqxf7vfcrz5wxsff80136v4qz622rb5nhpyrdj915dn"; }; } From e30a67f876a363025892c73dc0db321ed4d9f26e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 6 Apr 2025 13:43:56 +0200 Subject: [PATCH 185/218] lock: update --- lock.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lock.nix b/lock.nix index a6993db..923222a 100644 --- a/lock.nix +++ b/lock.nix @@ -4,15 +4,15 @@ sha256 = "09j4kvsxw1d5dvnhbsgih0icbrxqv90nzf0b589rb5z6gnzwjnqf"; }; nixpkgs = { - revision = "44a69ed688786e98a101f02b712c313f1ade37ab"; - sha256 = "19q0mqqzab5n7q5smw4yryplz52n838k11afdir49db73d8qly5x"; + revision = "bdb91860de2f719b57eef819b5617762f7120c70"; + sha256 = "16qxwcv06kimml219dp69dj83nf7wdfskvysnszaqyn40868nlmk"; }; nixpkgs-unstable = { - revision = "2c8d3f48d33929642c1c12cd243df4cc7d2ce434"; - sha256 = "0lbn29dn647kgf3g3nzch8an3m0gn2ysrmq8l7q6lzc8lgwgif8p"; + revision = "42a1c966be226125b48c384171c44c651c236c22"; + sha256 = "082dpl311xlspwm5l3h2hf10ww6l59m7k2g2hdrqs4kwwsj9x6mf"; }; cosmic-modules = { - revision = "b91eebbf1f88bc817bab333e278da7119d3db01b"; - sha256 = "1fjrwvdzfiqxf7vfcrz5wxsff80136v4qz622rb5nhpyrdj915dn"; + revision = "da24e5b3ed611c542ea63dee094f0beb29dcd7ad"; + sha256 = "10sd8f9kyz3cv1ngnr0s6zwckllsv0hisrrpkfz1bcqn2mwpqy59"; }; } From 5b16eb9aba6d306c222f4f9501913d93775e9359 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 12:36:26 +0200 Subject: [PATCH 186/218] nixos/nix: use remote sudo by default for nixos-rebuild --- nix-os/nix.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nix-os/nix.nix b/nix-os/nix.nix index 78d8586..c9feb60 100644 --- a/nix-os/nix.nix +++ b/nix-os/nix.nix @@ -46,7 +46,8 @@ let postBuild = '' wrapProgram $out/bin/nixos-rebuild \ --add-flags "--log-format" \ - --add-flags "bar" + --add-flags "bar" \ + --add-flags "--use-remote-sudo" ''; }; in { From 4dab0aff15a5f4284a47309a2c10ee1789b62338 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 12:41:16 +0200 Subject: [PATCH 187/218] treewide: standardize comments referencing nixpkgs pr --- nix-os/module-overrides.nix | 3 +-- nix-os/nix.nix | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/nix-os/module-overrides.nix b/nix-os/module-overrides.nix index 6b5f76e..5938ce5 100644 --- a/nix-os/module-overrides.nix +++ b/nix-os/module-overrides.nix @@ -1,9 +1,8 @@ { lib, ... }: let moduleOverrides = [ - # TODO: Remove after updating to nixos 25.05 + # NIXPKGS-PR: 359882 { - # https://github.com/NixOS/nixpkgs/pull/359882 disabledModules = [ "system/boot/luksroot.nix" ]; diff --git a/nix-os/nix.nix b/nix-os/nix.nix index c9feb60..959ed8f 100644 --- a/nix-os/nix.nix +++ b/nix-os/nix.nix @@ -28,8 +28,7 @@ let }; }; - # nixpkgs PR389487 - # https://github.com/NixOS/nixpkgs/pull/389487 + # NIXPKGS-PR: 389487 futureNixosExecutables = let nixpkgs = builtins.fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/e8f4dba5135ce202c7ef77118f145ef8b3803088.tar.gz"; From 27b241adfffdcaf866b52ba51d19d85c7bf7b4fc Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 12:54:34 +0200 Subject: [PATCH 188/218] treewide: restructure modules make every module contain config attribute and if module doesn't use module arguments, don't make it a function --- nix-os/account.nix | 76 +++++---- nix-os/core.nix | 136 +++++++-------- nix-os/docker.nix | 68 ++++---- nix-os/locale.nix | 2 - nix-os/nvidia.nix | 46 ++--- nix-os/polkit/disable-shutdown.nix | 84 ++++----- nix-os/razer.nix | 46 ++--- nix-os/shell.nix | 229 ++++++++++++------------- nix-os/virtualization.nix | 18 +- nix-os/xdg-default-apps.nix | 262 ++++++++++++++--------------- 10 files changed, 490 insertions(+), 477 deletions(-) diff --git a/nix-os/account.nix b/nix-os/account.nix index 492f09f..8d8a2ca 100644 --- a/nix-os/account.nix +++ b/nix-os/account.nix @@ -4,44 +4,46 @@ imports = [ ./unstable-packages.nix ]; - users.users.wroclaw = { - isNormalUser = true; - description = "Rafał"; - group = "wroclaw"; - extraGroups = [ - "users" - "wheel" - ] ++ lib.optional config.programs.adb.enable "adbusers"; - linger = true; - initialPassword = "nixos"; - packages = with pkgs; [ - firefox - (vivaldi.override { - proprietaryCodecs = true; - commandLineArgs = [ "--ozone-platform=wayland" ]; - }) - vesktop - unstablePkgs.vscode - gimp - inkscape - jitsi-meet-electron - krita - telegram-desktop - unstablePkgs.zettlr - ]; - }; - users.groups.wroclaw.gid = 1000; + config = { + users.users.wroclaw = { + isNormalUser = true; + description = "Rafał"; + group = "wroclaw"; + extraGroups = [ + "users" + "wheel" + ] ++ lib.optional config.programs.adb.enable "adbusers"; + linger = true; + initialPassword = "nixos"; + packages = with pkgs; [ + firefox + (vivaldi.override { + proprietaryCodecs = true; + commandLineArgs = [ "--ozone-platform=wayland" ]; + }) + vesktop + unstablePkgs.vscode + gimp + inkscape + jitsi-meet-electron + krita + telegram-desktop + unstablePkgs.zettlr + ]; + }; + users.groups.wroclaw.gid = 1000; - programs.steam = { - enable = true; - remotePlay.openFirewall = true; - }; + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + }; - services.syncthing = { - enable = true; - user = "wroclaw"; - group = "wroclaw"; - dataDir = "/home/wroclaw"; - configDir = "/home/wroclaw/.config/syncthing"; + services.syncthing = { + enable = true; + user = "wroclaw"; + group = "wroclaw"; + dataDir = "/home/wroclaw"; + configDir = "/home/wroclaw/.config/syncthing"; + }; }; } diff --git a/nix-os/core.nix b/nix-os/core.nix index 34c6f41..a65ffe1 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -10,78 +10,80 @@ ./module-overrides.nix ./nix.nix ]; + config = { - # kernel - boot.kernelPackages = pkgs.linuxPackages_latest; + # kernel + boot.kernelPackages = pkgs.linuxPackages_latest; - # Enable networking - networking.networkmanager.enable = true; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - nix = { - channel.enable = false; - settings.experimental-features = [ - "no-url-literals" - ]; - nixPath = [ - "nixpkgs=${pkgs.selfExpr { useConfig = false; }}" - "systemNixpkgs=${pkgs.selfExpr { useConfig = true; name = "systemNixpkgs-self"; }}" - # don't garbage collect the nixpkgs input - "inputsNixpkgs=${inputs.nixpkgs}" - "nixos-system=/etc/nixos/default.nix" - ]; - }; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - waypipe - wget - ffmpeg - yt-dlp - htop - btop - fastfetch - smartmontools - ddrescue - ]; - programs.git.enable = true; - programs.git.config = { - commit.verbose = true; - init.defaultBranch = "main"; - merge.conflictstyle = "diff3"; - rerere.enabled = true; - }; - - # Use nix-index for command-not-found handler - programs.command-not-found.enable = false; - programs.nix-index = { - package = pkgs.nix-index.override { - nix-index-unwrapped = pkgs.nix-index-unwrapped.overrideAttrs (oldAttrs: { - patches = oldAttrs.patches or [] ++ [ - ../pkgs/by-name/ni/nix-index/cnfOutput.patch - ]; - }); + # Enable networking + networking.networkmanager.enable = true; + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + nix = { + channel.enable = false; + settings.experimental-features = [ + "no-url-literals" + ]; + nixPath = [ + "nixpkgs=${pkgs.selfExpr { useConfig = false; }}" + "systemNixpkgs=${pkgs.selfExpr { useConfig = true; name = "systemNixpkgs-self"; }}" + # don't garbage collect the nixpkgs input + "inputsNixpkgs=${inputs.nixpkgs}" + "nixos-system=/etc/nixos/default.nix" + ]; }; - enable = true; - enableBashIntegration = true; - }; - # Enable fail2ban because of the OpenSSH server - services.fail2ban = { - enable = true; - maxretry = 10; - bantime = "7d"; - }; - - # Enable the OpenSSH daemon. - services.openssh = { - enable = true; - ports = [ - 22 - 8022 + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + waypipe + wget + ffmpeg + yt-dlp + htop + btop + fastfetch + smartmontools + ddrescue ]; + programs.git.enable = true; + programs.git.config = { + commit.verbose = true; + init.defaultBranch = "main"; + merge.conflictstyle = "diff3"; + rerere.enabled = true; + }; + + # Use nix-index for command-not-found handler + programs.command-not-found.enable = false; + programs.nix-index = { + package = pkgs.nix-index.override { + nix-index-unwrapped = pkgs.nix-index-unwrapped.overrideAttrs (oldAttrs: { + patches = oldAttrs.patches or [] ++ [ + ../pkgs/by-name/ni/nix-index/cnfOutput.patch + ]; + }); + + }; + enable = true; + enableBashIntegration = true; + }; + + # Enable fail2ban because of the OpenSSH server + services.fail2ban = { + enable = true; + maxretry = 10; + bantime = "7d"; + }; + + # Enable the OpenSSH daemon. + services.openssh = { + enable = true; + ports = [ + 22 + 8022 + ]; + }; }; } diff --git a/nix-os/docker.nix b/nix-os/docker.nix index 4583f6f..747b2f6 100644 --- a/nix-os/docker.nix +++ b/nix-os/docker.nix @@ -1,39 +1,41 @@ { lib, config, pkgs, ... }: { - config.virtualisation.docker = { - enable = true; - enableOnBoot = true; - storageDriver = if config.fileSystems."/".fsType == "btrfs" then "btrfs" else null; - rootless.enable = true; - rootless.setSocketVariable = true; - daemon.settings = { - default-address-pools = [ - {base = "10.64.0.0/10"; size = 24;} - ]; - bip = "10.127.0.1/16"; + config = { + virtualisation.docker = { + enable = true; + enableOnBoot = true; + storageDriver = if config.fileSystems."/".fsType == "btrfs" then "btrfs" else null; + rootless.enable = true; + rootless.setSocketVariable = true; + daemon.settings = { + default-address-pools = [ + {base = "10.64.0.0/10"; size = 24;} + ]; + bip = "10.127.0.1/16"; + }; + }; + users.users.indocker = { + isSystemUser = true; + hashedPassword = "!"; + uid = 900; + group = "indocker"; + }; + users.groups.indocker = { + gid = 900; + }; + environment.systemPackages = with pkgs; [ + docker-compose + ]; + + # Docker enables firewall anyway, let's enable the firewall for it if it's disabled + # TODO: Apply only when config.networking.firewall is false + networking.firewall = { + enable = lib.mkOverride 90 true; + allowedTCPPorts = lib.mkOverride 90 []; + allowedUDPPorts = lib.mkOverride 90 []; + allowedTCPPortRanges = lib.mkOverride 90 [{ from = 0; to = 65535;}]; + allowedUDPPortRanges = lib.mkOverride 90 [{ from = 0; to = 65535;}]; }; }; - config.users.users.indocker = { - isSystemUser = true; - hashedPassword = "!"; - uid = 900; - group = "indocker"; - }; - config.users.groups.indocker = { - gid = 900; - }; - config.environment.systemPackages = with pkgs; [ - docker-compose - ]; - - # Docker enables firewall anyway, let's enable the firewall for it if it's disabled - # TODO: Apply only when config.networking.firewall is false - config.networking.firewall = { - enable = lib.mkOverride 90 true; - allowedTCPPorts = lib.mkOverride 90 []; - allowedUDPPorts = lib.mkOverride 90 []; - allowedTCPPortRanges = lib.mkOverride 90 [{ from = 0; to = 65535;}]; - allowedUDPPortRanges = lib.mkOverride 90 [{ from = 0; to = 65535;}]; - }; } diff --git a/nix-os/locale.nix b/nix-os/locale.nix index faf0f89..3f56bde 100644 --- a/nix-os/locale.nix +++ b/nix-os/locale.nix @@ -1,5 +1,3 @@ -{ ... }: - { config = { # Set your time zone. diff --git a/nix-os/nvidia.nix b/nix-os/nvidia.nix index 2c10f15..a9433f3 100644 --- a/nix-os/nvidia.nix +++ b/nix-os/nvidia.nix @@ -1,28 +1,30 @@ { config, lib, pkgs, ...}: { - hardware.graphics = { - enable = true; - enable32Bit = true; - }; - - # Workaround for nvidia driver ghost display - boot.kernelParams = [ "nvidia_drm.fbdev=1" ]; - - services.xserver.videoDrivers = ["nvidia"]; - hardware.nvidia = { - modesetting.enable = true; - powerManagement.enable = true; - open = false; - nvidiaSettings = true; - package = config.boot.kernelPackages.nvidiaPackages.mkDriver { - version = "570.133.07"; - sha256_64bit = "sha256-LUPmTFgb5e9VTemIixqpADfvbUX1QoTT2dztwI3E3CY="; - sha256_aarch64 = "sha256-yTovUno/1TkakemRlNpNB91U+V04ACTMwPEhDok7jI0="; - openSha256 = "sha256-9l8N83Spj0MccA8+8R1uqiXBS0Ag4JrLPjrU3TaXHnM="; - settingsSha256 = "sha256-XMk+FvTlGpMquM8aE8kgYK2PIEszUZD2+Zmj2OpYrzU="; - persistencedSha256 = "sha256-G1V7JtHQbfnSRfVjz/LE2fYTlh9okpCbE4dfX9oYSg8="; + config = { + hardware.graphics = { + enable = true; + enable32Bit = true; }; + + # Workaround for nvidia driver ghost display + boot.kernelParams = [ "nvidia_drm.fbdev=1" ]; + + services.xserver.videoDrivers = ["nvidia"]; + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = true; + open = false; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.mkDriver { + version = "570.133.07"; + sha256_64bit = "sha256-LUPmTFgb5e9VTemIixqpADfvbUX1QoTT2dztwI3E3CY="; + sha256_aarch64 = "sha256-yTovUno/1TkakemRlNpNB91U+V04ACTMwPEhDok7jI0="; + openSha256 = "sha256-9l8N83Spj0MccA8+8R1uqiXBS0Ag4JrLPjrU3TaXHnM="; + settingsSha256 = "sha256-XMk+FvTlGpMquM8aE8kgYK2PIEszUZD2+Zmj2OpYrzU="; + persistencedSha256 = "sha256-G1V7JtHQbfnSRfVjz/LE2fYTlh9okpCbE4dfX9oYSg8="; + }; + }; + nixpkgs.config.nvidia.acceptLicense = true; }; - nixpkgs.config.nvidia.acceptLicense = true; } diff --git a/nix-os/polkit/disable-shutdown.nix b/nix-os/polkit/disable-shutdown.nix index 660c32a..dc7343e 100644 --- a/nix-os/polkit/disable-shutdown.nix +++ b/nix-os/polkit/disable-shutdown.nix @@ -1,44 +1,44 @@ -{ ... }: - { - security.polkit.extraConfig = '' - polkit.addRule(function(action, subject) { - polkit.log("action=" + action); - polkit.log("subject=" + subject); - if ( - action.id == "org.freedesktop.login1.halt" || - action.id == "org.freedesktop.login1.halt-ignore-inhibit" || - action.id == "org.freedesktop.login1.halt-multiple-sessions" || - action.id == "org.freedesktop.login1.hibernate" || - action.id == "org.freedesktop.login1.hibernate-ignore-inhibit" || - action.id == "org.freedesktop.login1.hibernate-multiple-sessions" || - action.id == "org.freedesktop.login1.inhibit-block-idle" || - action.id == "org.freedesktop.login1.inhibit-block-shutdown" || - action.id == "org.freedesktop.login1.inhibit-block-sleep" || - action.id == "org.freedesktop.login1.inhibit-handle-hibernate-key" || - action.id == "org.freedesktop.login1.inhibit-handle-lid-switch" || - action.id == "org.freedesktop.login1.inhibit-handle-power-key" || - action.id == "org.freedesktop.login1.inhibit-handle-reboot-key" || - action.id == "org.freedesktop.login1.inhibit-handle-suspend-key" || - action.id == "org.freedesktop.login1.power-off" || - action.id == "org.freedesktop.login1.power-off-ignore-inhibit" || - action.id == "org.freedesktop.login1.power-off-multiple-sessions" || - action.id == "org.freedesktop.login1.reboot" || - action.id == "org.freedesktop.login1.reboot-ignore-inhibit" || - action.id == "org.freedesktop.login1.reboot-multiple-sessions" || - action.id == "org.freedesktop.login1.set-reboot-parameter" || - action.id == "org.freedesktop.login1.set-reboot-to-boot-loader-entry" || - action.id == "org.freedesktop.login1.set-reboot-to-boot-loader-menu" || - action.id == "org.freedesktop.login1.set-reboot-to-firmware-setup" || - action.id == "org.freedesktop.login1.set-self-linger" || - action.id == "org.freedesktop.login1.set-user-linger" || - action.id == "org.freedesktop.login1.set-wall-message" || - action.id == "org.freedesktop.login1.suspend" || - action.id == "org.freedesktop.login1.suspend-ignore-inhibit" || - action.id == "org.freedesktop.login1.suspend-multiple-sessions" - ) { - return subject.active ? polkit.Result.AUTH_ADMIN : polkit.Result.NO; - }; - }); - ''; + config = { + security.polkit.extraConfig = '' + polkit.addRule(function(action, subject) { + polkit.log("action=" + action); + polkit.log("subject=" + subject); + if ( + action.id == "org.freedesktop.login1.halt" || + action.id == "org.freedesktop.login1.halt-ignore-inhibit" || + action.id == "org.freedesktop.login1.halt-multiple-sessions" || + action.id == "org.freedesktop.login1.hibernate" || + action.id == "org.freedesktop.login1.hibernate-ignore-inhibit" || + action.id == "org.freedesktop.login1.hibernate-multiple-sessions" || + action.id == "org.freedesktop.login1.inhibit-block-idle" || + action.id == "org.freedesktop.login1.inhibit-block-shutdown" || + action.id == "org.freedesktop.login1.inhibit-block-sleep" || + action.id == "org.freedesktop.login1.inhibit-handle-hibernate-key" || + action.id == "org.freedesktop.login1.inhibit-handle-lid-switch" || + action.id == "org.freedesktop.login1.inhibit-handle-power-key" || + action.id == "org.freedesktop.login1.inhibit-handle-reboot-key" || + action.id == "org.freedesktop.login1.inhibit-handle-suspend-key" || + action.id == "org.freedesktop.login1.power-off" || + action.id == "org.freedesktop.login1.power-off-ignore-inhibit" || + action.id == "org.freedesktop.login1.power-off-multiple-sessions" || + action.id == "org.freedesktop.login1.reboot" || + action.id == "org.freedesktop.login1.reboot-ignore-inhibit" || + action.id == "org.freedesktop.login1.reboot-multiple-sessions" || + action.id == "org.freedesktop.login1.set-reboot-parameter" || + action.id == "org.freedesktop.login1.set-reboot-to-boot-loader-entry" || + action.id == "org.freedesktop.login1.set-reboot-to-boot-loader-menu" || + action.id == "org.freedesktop.login1.set-reboot-to-firmware-setup" || + action.id == "org.freedesktop.login1.set-self-linger" || + action.id == "org.freedesktop.login1.set-user-linger" || + action.id == "org.freedesktop.login1.set-wall-message" || + action.id == "org.freedesktop.login1.suspend" || + action.id == "org.freedesktop.login1.suspend-ignore-inhibit" || + action.id == "org.freedesktop.login1.suspend-multiple-sessions" + ) { + return subject.active ? polkit.Result.AUTH_ADMIN : polkit.Result.NO; + }; + }); + ''; + }; } diff --git a/nix-os/razer.nix b/nix-os/razer.nix index f1df5ff..202541d 100644 --- a/nix-os/razer.nix +++ b/nix-os/razer.nix @@ -18,29 +18,31 @@ }) ]; - hardware.openrazer = { - enable = true; - users = [ - "wroclaw" - ]; - # NIXPKGS-PR: 384992 - packages = let - oldVersion = pkgs.python3Packages.openrazer-daemon.version; - version = "3.10.1"; - in lib.mapAttrs (_: package: package.overrideAttrs (oldAttrs: { - version = lib.replaceStrings [ oldVersion ] [ version ] oldAttrs.version; - src = pkgs.fetchFromGitHub { - owner = "openrazer"; - repo = "openrazer"; - tag = "v${version}"; - hash = "sha256-igrGx7Y6ENtZatJCTAW43/0q6ZjljJ9/kU3QFli4yIU="; + config = { + hardware.openrazer = { + enable = true; + users = [ + "wroclaw" + ]; + # NIXPKGS-PR: 384992 + packages = let + oldVersion = pkgs.python3Packages.openrazer-daemon.version; + version = "3.10.1"; + in lib.mapAttrs (_: package: package.overrideAttrs (oldAttrs: { + version = lib.replaceStrings [ oldVersion ] [ version ] oldAttrs.version; + src = pkgs.fetchFromGitHub { + owner = "openrazer"; + repo = "openrazer"; + tag = "v${version}"; + hash = "sha256-igrGx7Y6ENtZatJCTAW43/0q6ZjljJ9/kU3QFli4yIU="; + }; + })) { + kernel = config.boot.kernelPackages.openrazer; + daemon = pkgs.python3Packages.openrazer-daemon; }; - })) { - kernel = config.boot.kernelPackages.openrazer; - daemon = pkgs.python3Packages.openrazer-daemon; }; + environment.systemPackages = with pkgs; [ + polychromatic + ]; }; - environment.systemPackages = with pkgs; [ - polychromatic - ]; } diff --git a/nix-os/shell.nix b/nix-os/shell.nix index 01f59ea..e30c9a7 100644 --- a/nix-os/shell.nix +++ b/nix-os/shell.nix @@ -25,136 +25,139 @@ in imports = [ ./unstable-packages.nix ]; - environment.systemPackages = with pkgs; [ - aliasDrag - rangerGit - ripgrep - kitty - zoxide - ]; - programs.bash.shellInit = '' - HISTCONTROL=ignoreboth - ''; + config = { + environment.systemPackages = with pkgs; [ + aliasDrag + rangerGit + ripgrep + kitty + zoxide + ]; - programs.bash.interactiveShellInit = '' - HISTCONTROL=ignoreboth - if test -n "$KITTY_INSTALLATION_DIR"; then - export KITTY_SHELL_INTEGRATION="enabled,no-sudo" - source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash" - fi - eval "''$(zoxide init bash)" - alias bye=exit - ''; + programs.bash.shellInit = '' + HISTCONTROL=ignoreboth + ''; - environment.etc."xdg/kitty/kitty.conf".text = '' - font_family MesloLGS Nerd Font - font_size 10.0 - scrollback_lines 10000 - window_border_width 0.5 - window_padding_width 3 - ${if config.services.xserver.desktopManager.gnome.enable then "hide_window_decorations yes" else ""} - background_opacity 0.8 - dynamic_background_opacity yes + programs.bash.interactiveShellInit = '' + HISTCONTROL=ignoreboth + if test -n "$KITTY_INSTALLATION_DIR"; then + export KITTY_SHELL_INTEGRATION="enabled,no-sudo" + source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash" + fi + eval "''$(zoxide init bash)" + alias bye=exit + ''; - map kitty_mod+alt+c copy_ansi_to_clipboard - ''; + environment.etc."xdg/kitty/kitty.conf".text = '' + font_family MesloLGS Nerd Font + font_size 10.0 + scrollback_lines 10000 + window_border_width 0.5 + window_padding_width 3 + ${if config.services.xserver.desktopManager.gnome.enable then "hide_window_decorations yes" else ""} + background_opacity 0.8 + dynamic_background_opacity yes - environment.etc."ranger/rc.conf".text = '' - eval import os; fm.set_option_from_string("preview_images", "true") if "KITTY_INSTALLATION_DIR" in os.environ else None; - eval import os; fm.set_option_from_string("preview_images_method", "kitty") if "KITTY_INSTALLATION_DIR" in os.environ else None; - set vcs_aware true - set show_hidden true + map kitty_mod+alt+c copy_ansi_to_clipboard + ''; - alias drag shell ${pkgs.ripdrag}/bin/ripdrag -Axd %p & - map drag - ''; + environment.etc."ranger/rc.conf".text = '' + eval import os; fm.set_option_from_string("preview_images", "true") if "KITTY_INSTALLATION_DIR" in os.environ else None; + eval import os; fm.set_option_from_string("preview_images_method", "kitty") if "KITTY_INSTALLATION_DIR" in os.environ else None; + set vcs_aware true + set show_hidden true - environment.etc."ranger/plugins/zoxide.py".source = pkgs.fetchFromGitHub { - owner = "jchook"; - repo = "ranger-zoxide"; - rev = "281828de060299f73fe0b02fcabf4f2f2bd78ab3"; - hash = "sha256-JEuyYSVa1NS3aftezEJx/k19lwwzf7XhqBCL0jH6VT4="; - } + /__init__.py; + alias drag shell ${pkgs.ripdrag}/bin/ripdrag -Axd %p & + map drag + ''; - programs.direnv.enable = true; + environment.etc."ranger/plugins/zoxide.py".source = pkgs.fetchFromGitHub { + owner = "jchook"; + repo = "ranger-zoxide"; + rev = "281828de060299f73fe0b02fcabf4f2f2bd78ab3"; + hash = "sha256-JEuyYSVa1NS3aftezEJx/k19lwwzf7XhqBCL0jH6VT4="; + } + /__init__.py; - programs.neovim = { - enable = true; - viAlias = true; - vimAlias = true; - configure = { - customRC = '' - set number - set hlsearch - set incsearch - set tabstop=4 - set softtabstop=4 - set shiftwidth=4 - set expandtab - set autoindent - set updatetime=500 - colorscheme vim + programs.direnv.enable = true; - syntax on - set encoding=utf-8 - set wildmode=longest,list,full - set listchars=space:·,tab:┄┄» - set indentkeys-=0# + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + configure = { + customRC = '' + set number + set hlsearch + set incsearch + set tabstop=4 + set softtabstop=4 + set shiftwidth=4 + set expandtab + set autoindent + set updatetime=500 + colorscheme vim - " rainbow-delimeters-nvim - let g:rainbow_delimiters = { - \ 'strategy': { - \ ${"''"}: rainbow_delimiters#strategy.global, - \ }, - \ } + syntax on + set encoding=utf-8 + set wildmode=longest,list,full + set listchars=space:·,tab:┄┄» + set indentkeys-=0# - " vim-gitguter - set signcolumn=yes - highlight SignColumn NONE - highlight GitGutterAdd ctermfg=2 guifg=#2ea043 - highlight GitGutterChange ctermfg=4 guifg=#0078d4 - highlight GitGutterDelete ctermfg=1 guifg=#f85149 + " rainbow-delimeters-nvim + let g:rainbow_delimiters = { + \ 'strategy': { + \ ${"''"}: rainbow_delimiters#strategy.global, + \ }, + \ } - lua require('guess-indent').setup {} - ''; - packages.myVimPackage = with pkgs.vimPlugins; { - start = [ - guess-indent-nvim - vim-visual-multi - autoclose-nvim - rainbow-delimiters-nvim - vimagit - vim-gitgutter - ]; + " vim-gitguter + set signcolumn=yes + highlight SignColumn NONE + highlight GitGutterAdd ctermfg=2 guifg=#2ea043 + highlight GitGutterChange ctermfg=4 guifg=#0078d4 + highlight GitGutterDelete ctermfg=1 guifg=#f85149 + + lua require('guess-indent').setup {} + ''; + packages.myVimPackage = with pkgs.vimPlugins; { + start = [ + guess-indent-nvim + vim-visual-multi + autoclose-nvim + rainbow-delimiters-nvim + vimagit + vim-gitgutter + ]; + }; }; }; - }; - environment.variables = lib.mkIf config.programs.neovim.enable rec { - EDITOR = "/run/current-system/sw/bin/nvim"; - VISUAL = EDITOR; - }; + environment.variables = lib.mkIf config.programs.neovim.enable rec { + EDITOR = "/run/current-system/sw/bin/nvim"; + VISUAL = EDITOR; + }; - programs.starship = { - enable = true; - settings = { - format = "$all$line_break\${custom.ranger}$jobs$battery$time$status$os$container$shell$character"; - directory = { - truncation_length = 5; - truncation_symbol = "…/"; - }; - hostname = { - ssh_only = false; - }; - username = { - show_always = true; - }; - status.disabled = false; - custom.ranger = { - when = "test $RANGER_LEVEL"; - command = "echo \"✦\""; - style = "bold 208"; + programs.starship = { + enable = true; + settings = { + format = "$all$line_break\${custom.ranger}$jobs$battery$time$status$os$container$shell$character"; + directory = { + truncation_length = 5; + truncation_symbol = "…/"; + }; + hostname = { + ssh_only = false; + }; + username = { + show_always = true; + }; + status.disabled = false; + custom.ranger = { + when = "test $RANGER_LEVEL"; + command = "echo \"✦\""; + style = "bold 208"; + }; }; }; }; diff --git a/nix-os/virtualization.nix b/nix-os/virtualization.nix index c1e062f..38b8116 100644 --- a/nix-os/virtualization.nix +++ b/nix-os/virtualization.nix @@ -2,15 +2,17 @@ { lib, config, pkgs, ... }: { - #virtualisation.waydroid.enable = true; - programs.virt-manager.enable = true; - virtualisation.libvirtd = { - enable = true; - qemu.ovmf = { + config = { + #virtualisation.waydroid.enable = true; + programs.virt-manager.enable = true; + virtualisation.libvirtd = { enable = true; - packages = [ - pkgs.OVMFFull.fd - ]; + qemu.ovmf = { + enable = true; + packages = [ + pkgs.OVMFFull.fd + ]; + }; }; }; } diff --git a/nix-os/xdg-default-apps.nix b/nix-os/xdg-default-apps.nix index 5033d02..632c06d 100644 --- a/nix-os/xdg-default-apps.nix +++ b/nix-os/xdg-default-apps.nix @@ -1,137 +1,137 @@ -{ ... }: - { - xdg.mime.enable = true; - xdg.mime.defaultApplications = { - # Browser - "x-scheme-handler/http" = "vivaldi-stable.desktop"; - "application/xhtml+xml" = "vivaldi-stable.desktop"; - "text/html" = "vivaldi-stable.desktop"; - "x-scheme-handler/https" = "vivaldi-stable.desktop"; - "application/pdf" = "vivaldi-stable.desktop"; + config = { + xdg.mime.enable = true; + xdg.mime.defaultApplications = { + # Browser + "x-scheme-handler/http" = "vivaldi-stable.desktop"; + "application/xhtml+xml" = "vivaldi-stable.desktop"; + "text/html" = "vivaldi-stable.desktop"; + "x-scheme-handler/https" = "vivaldi-stable.desktop"; + "application/pdf" = "vivaldi-stable.desktop"; - # Audio - "audio/aiff" = "mpv.desktop"; - "audio/basic" = "mpv.desktop"; - "audio/it" = "mpv.desktop"; - "audio/make" = "mpv.desktop"; - "audio/make.my.funk" = "mpv.desktop"; - "audio/mid" = "mpv.desktop"; - "audio/midi" = "mpv.desktop"; - "audio/mod" = "mpv.desktop"; - "audio/mpeg" = "mpv.desktop"; - "audio/mpeg3" = "mpv.desktop"; - "audio/nspaudio" = "mpv.desktop"; - "audio/s3m" = "mpv.desktop"; - "audio/tsp-audio" = "mpv.desktop"; - "audio/tsplayer" = "mpv.desktop"; - "audio/vnd.qcelp" = "mpv.desktop"; - "audio/voc" = "mpv.desktop"; - "audio/voxware" = "mpv.desktop"; - "audio/wav" = "mpv.desktop"; - "audio/x-adpcm" = "mpv.desktop"; - "audio/x-aiff" = "mpv.desktop"; - "audio/x-au" = "mpv.desktop"; - "audio/x-gsm" = "mpv.desktop"; - "audio/x-jam" = "mpv.desktop"; - "audio/x-liveaudio" = "mpv.desktop"; - "audio/x-mid" = "mpv.desktop"; - "audio/x-midi" = "mpv.desktop"; - "audio/x-mod" = "mpv.desktop"; - "audio/x-mpeg" = "mpv.desktop"; - "audio/x-mpeg-3" = "mpv.desktop"; - "audio/x-mpequrl" = "mpv.desktop"; - "audio/x-nspaudio" = "mpv.desktop"; - "audio/x-pn-realaudio" = "mpv.desktop"; - "audio/x-pn-realaudio-plugin" = "mpv.desktop"; - "audio/x-psid" = "mpv.desktop"; - "audio/x-realaudio" = "mpv.desktop"; - "audio/x-twinvq" = "mpv.desktop"; - "audio/x-twinvq-plugin" = "mpv.desktop"; - "audio/x-vnd.audioexplosion.mjuicemediafile" = "mpv.desktop"; - "audio/x-voc" = "mpv.desktop"; - "audio/x-wav" = "mpv.desktop"; - "audio/xm" = "mpv.desktop"; + # Audio + "audio/aiff" = "mpv.desktop"; + "audio/basic" = "mpv.desktop"; + "audio/it" = "mpv.desktop"; + "audio/make" = "mpv.desktop"; + "audio/make.my.funk" = "mpv.desktop"; + "audio/mid" = "mpv.desktop"; + "audio/midi" = "mpv.desktop"; + "audio/mod" = "mpv.desktop"; + "audio/mpeg" = "mpv.desktop"; + "audio/mpeg3" = "mpv.desktop"; + "audio/nspaudio" = "mpv.desktop"; + "audio/s3m" = "mpv.desktop"; + "audio/tsp-audio" = "mpv.desktop"; + "audio/tsplayer" = "mpv.desktop"; + "audio/vnd.qcelp" = "mpv.desktop"; + "audio/voc" = "mpv.desktop"; + "audio/voxware" = "mpv.desktop"; + "audio/wav" = "mpv.desktop"; + "audio/x-adpcm" = "mpv.desktop"; + "audio/x-aiff" = "mpv.desktop"; + "audio/x-au" = "mpv.desktop"; + "audio/x-gsm" = "mpv.desktop"; + "audio/x-jam" = "mpv.desktop"; + "audio/x-liveaudio" = "mpv.desktop"; + "audio/x-mid" = "mpv.desktop"; + "audio/x-midi" = "mpv.desktop"; + "audio/x-mod" = "mpv.desktop"; + "audio/x-mpeg" = "mpv.desktop"; + "audio/x-mpeg-3" = "mpv.desktop"; + "audio/x-mpequrl" = "mpv.desktop"; + "audio/x-nspaudio" = "mpv.desktop"; + "audio/x-pn-realaudio" = "mpv.desktop"; + "audio/x-pn-realaudio-plugin" = "mpv.desktop"; + "audio/x-psid" = "mpv.desktop"; + "audio/x-realaudio" = "mpv.desktop"; + "audio/x-twinvq" = "mpv.desktop"; + "audio/x-twinvq-plugin" = "mpv.desktop"; + "audio/x-vnd.audioexplosion.mjuicemediafile" = "mpv.desktop"; + "audio/x-voc" = "mpv.desktop"; + "audio/x-wav" = "mpv.desktop"; + "audio/xm" = "mpv.desktop"; - # Video - "video/animaflex" = "mpv.desktop"; - "video/avi" = "mpv.desktop"; - "video/avs-video" = "mpv.desktop"; - "video/dl" = "mpv.desktop"; - "video/fli" = "mpv.desktop"; - "video/gl" = "mpv.desktop"; - "video/mpeg" = "mpv.desktop"; - "video/msvideo" = "mpv.desktop"; - "video/quicktime" = "mpv.desktop"; - "video/vdo" = "mpv.desktop"; - "video/vivo" = "mpv.desktop"; - "video/vnd.rn-realvideo" = "mpv.desktop"; - "video/vnd.vivo" = "mpv.desktop"; - "video/vosaic" = "mpv.desktop"; - "video/x-amt-demorun" = "mpv.desktop"; - "video/x-amt-showrun" = "mpv.desktop"; - "video/x-atomic3d-feature" = "mpv.desktop"; - "video/x-dl" = "mpv.desktop"; - "video/x-dv" = "mpv.desktop"; - "video/x-fli" = "mpv.desktop"; - "video/x-gl" = "mpv.desktop"; - "video/x-isvideo" = "mpv.desktop"; - "video/x-motion-jpeg" = "mpv.desktop"; - "video/x-mpeg" = "mpv.desktop"; - "video/x-mpeq2a" = "mpv.desktop"; - "video/x-ms-asf" = "mpv.desktop"; - "video/x-ms-asf-plugin" = "mpv.desktop"; - "video/x-msvideo" = "mpv.desktop"; - "video/x-qtc" = "mpv.desktop"; - "video/x-scm" = "mpv.desktop"; - "video/x-sgi-movie" = "mpv.desktop"; + # Video + "video/animaflex" = "mpv.desktop"; + "video/avi" = "mpv.desktop"; + "video/avs-video" = "mpv.desktop"; + "video/dl" = "mpv.desktop"; + "video/fli" = "mpv.desktop"; + "video/gl" = "mpv.desktop"; + "video/mpeg" = "mpv.desktop"; + "video/msvideo" = "mpv.desktop"; + "video/quicktime" = "mpv.desktop"; + "video/vdo" = "mpv.desktop"; + "video/vivo" = "mpv.desktop"; + "video/vnd.rn-realvideo" = "mpv.desktop"; + "video/vnd.vivo" = "mpv.desktop"; + "video/vosaic" = "mpv.desktop"; + "video/x-amt-demorun" = "mpv.desktop"; + "video/x-amt-showrun" = "mpv.desktop"; + "video/x-atomic3d-feature" = "mpv.desktop"; + "video/x-dl" = "mpv.desktop"; + "video/x-dv" = "mpv.desktop"; + "video/x-fli" = "mpv.desktop"; + "video/x-gl" = "mpv.desktop"; + "video/x-isvideo" = "mpv.desktop"; + "video/x-motion-jpeg" = "mpv.desktop"; + "video/x-mpeg" = "mpv.desktop"; + "video/x-mpeq2a" = "mpv.desktop"; + "video/x-ms-asf" = "mpv.desktop"; + "video/x-ms-asf-plugin" = "mpv.desktop"; + "video/x-msvideo" = "mpv.desktop"; + "video/x-qtc" = "mpv.desktop"; + "video/x-scm" = "mpv.desktop"; + "video/x-sgi-movie" = "mpv.desktop"; - # Image - "image/bmp" = "qimgv.desktop"; - "image/cmu-raster" = "qimgv.desktop"; - "image/fif" = "qimgv.desktop"; - "image/florian" = "qimgv.desktop"; - "image/g3fax" = "qimgv.desktop"; - "image/gif" = "qimgv.desktop"; - "image/ief" = "qimgv.desktop"; - "image/jpeg" = "qimgv.desktop"; - "image/jutvision" = "qimgv.desktop"; - "image/naplps" = "qimgv.desktop"; - "image/pict" = "qimgv.desktop"; - "image/pjpeg" = "qimgv.desktop"; - "image/png" = "qimgv.desktop"; - "image/tiff" = "qimgv.desktop"; - "image/vasa" = "qimgv.desktop"; - "image/vnd.dwg" = "qimgv.desktop"; - "image/vnd.fpx" = "qimgv.desktop"; - "image/vnd.net-fpx" = "qimgv.desktop"; - "image/vnd.rn-realflash" = "qimgv.desktop"; - "image/vnd.rn-realpix" = "qimgv.desktop"; - "image/vnd.wap.wbmp" = "qimgv.desktop"; - "image/vnd.xiff" = "qimgv.desktop"; - "image/x-cmu-raster" = "qimgv.desktop"; - "image/x-dwg" = "qimgv.desktop"; - "image/x-icon" = "qimgv.desktop"; - "image/x-jg" = "qimgv.desktop"; - "image/x-jps" = "qimgv.desktop"; - "image/x-niff" = "qimgv.desktop"; - "image/x-pcx" = "qimgv.desktop"; - "image/x-pict" = "qimgv.desktop"; - "image/x-portable-anymap" = "qimgv.desktop"; - "image/x-portable-bitmap" = "qimgv.desktop"; - "image/x-portable-graymap" = "qimgv.desktop"; - "image/x-portable-greymap" = "qimgv.desktop"; - "image/x-portable-pixmap" = "qimgv.desktop"; - "image/x-quicktime" = "qimgv.desktop"; - "image/x-rgb" = "qimgv.desktop"; - "image/x-tiff" = "qimgv.desktop"; - "image/x-windows-bmp" = "qimgv.desktop"; - "image/x-xbitmap" = "qimgv.desktop"; - "image/x-xbm" = "qimgv.desktop"; - "image/x-xpixmap" = "qimgv.desktop"; - "image/x-xwd" = "qimgv.desktop"; - "image/x-xwindowdump" = "qimgv.desktop"; - "image/xbm" = "qimgv.desktop"; - "image/xpm" = "qimgv.desktop"; + # Image + "image/bmp" = "qimgv.desktop"; + "image/cmu-raster" = "qimgv.desktop"; + "image/fif" = "qimgv.desktop"; + "image/florian" = "qimgv.desktop"; + "image/g3fax" = "qimgv.desktop"; + "image/gif" = "qimgv.desktop"; + "image/ief" = "qimgv.desktop"; + "image/jpeg" = "qimgv.desktop"; + "image/jutvision" = "qimgv.desktop"; + "image/naplps" = "qimgv.desktop"; + "image/pict" = "qimgv.desktop"; + "image/pjpeg" = "qimgv.desktop"; + "image/png" = "qimgv.desktop"; + "image/tiff" = "qimgv.desktop"; + "image/vasa" = "qimgv.desktop"; + "image/vnd.dwg" = "qimgv.desktop"; + "image/vnd.fpx" = "qimgv.desktop"; + "image/vnd.net-fpx" = "qimgv.desktop"; + "image/vnd.rn-realflash" = "qimgv.desktop"; + "image/vnd.rn-realpix" = "qimgv.desktop"; + "image/vnd.wap.wbmp" = "qimgv.desktop"; + "image/vnd.xiff" = "qimgv.desktop"; + "image/x-cmu-raster" = "qimgv.desktop"; + "image/x-dwg" = "qimgv.desktop"; + "image/x-icon" = "qimgv.desktop"; + "image/x-jg" = "qimgv.desktop"; + "image/x-jps" = "qimgv.desktop"; + "image/x-niff" = "qimgv.desktop"; + "image/x-pcx" = "qimgv.desktop"; + "image/x-pict" = "qimgv.desktop"; + "image/x-portable-anymap" = "qimgv.desktop"; + "image/x-portable-bitmap" = "qimgv.desktop"; + "image/x-portable-graymap" = "qimgv.desktop"; + "image/x-portable-greymap" = "qimgv.desktop"; + "image/x-portable-pixmap" = "qimgv.desktop"; + "image/x-quicktime" = "qimgv.desktop"; + "image/x-rgb" = "qimgv.desktop"; + "image/x-tiff" = "qimgv.desktop"; + "image/x-windows-bmp" = "qimgv.desktop"; + "image/x-xbitmap" = "qimgv.desktop"; + "image/x-xbm" = "qimgv.desktop"; + "image/x-xpixmap" = "qimgv.desktop"; + "image/x-xwd" = "qimgv.desktop"; + "image/x-xwindowdump" = "qimgv.desktop"; + "image/xbm" = "qimgv.desktop"; + "image/xpm" = "qimgv.desktop"; + }; }; } From 8ceac3ce8800eacd9414d284bebf09bd1fb51943 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 13:22:10 +0200 Subject: [PATCH 189/218] nixos/module-overrides: use modulesPath for luksroot override --- nix-os/module-overrides.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nix-os/module-overrides.nix b/nix-os/module-overrides.nix index 5938ce5..71df3de 100644 --- a/nix-os/module-overrides.nix +++ b/nix-os/module-overrides.nix @@ -1,10 +1,15 @@ -{ lib, ... }: +{ + lib, + modulesPath, + ... +}: + let moduleOverrides = [ # NIXPKGS-PR: 359882 { disabledModules = [ - "system/boot/luksroot.nix" + "${modulesPath}/system/boot/luksroot.nix" ]; replacementModules = [(builtins.fetchurl { url = "https://raw.githubusercontent.com/amozeo/nixpkgs/728d5806fe6f975ba3843297332d12e13119fe86/nixos/modules/system/boot/luksroot.nix"; From 0d62f52cd5e84bda7c8bda5d1f2792a0fb9590c8 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 13:25:03 +0200 Subject: [PATCH 190/218] nixos/razer: move module replacement to module-overrides.nix --- nix-os/module-overrides.nix | 12 ++++++++++++ nix-os/razer.nix | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/nix-os/module-overrides.nix b/nix-os/module-overrides.nix index 71df3de..ea19150 100644 --- a/nix-os/module-overrides.nix +++ b/nix-os/module-overrides.nix @@ -16,6 +16,18 @@ let sha256 = "0s2k8k6rrlwn2zb02q6fkvswln8w4hvh02hm4krqvkh46amyasyy"; })]; } + # NIXPKGS-PR: 394300 + { + disabledModules = [ + "${modulesPath}/hardware/openrazer.nix" + ]; + replacementModules = [ + (builtins.fetchurl { + url = "https://raw.githubusercontent.com/NixOS/nixpkgs/4a11562c20fbe7af7d5ac139dbf0f8d50ce276f6/nixos/modules/hardware/openrazer.nix"; + sha256 = "0n6kzrcwlmxgws4pmffyqagp2rxpfxmfjl11vgvlkjcbglg6fs7y"; + }) + ]; + } ]; toModule = entry: { diff --git a/nix-os/razer.nix b/nix-os/razer.nix index 202541d..f299e95 100644 --- a/nix-os/razer.nix +++ b/nix-os/razer.nix @@ -1,23 +1,11 @@ { config, lib, - modulesPath, pkgs, ... }: { - # NIXPKGS-PR: 394300 - disabledModules = [ - "${modulesPath}/hardware/openrazer.nix" - ]; - imports = [ - (builtins.fetchurl { - url = "https://raw.githubusercontent.com/NixOS/nixpkgs/4a11562c20fbe7af7d5ac139dbf0f8d50ce276f6/nixos/modules/hardware/openrazer.nix"; - sha256 = "0n6kzrcwlmxgws4pmffyqagp2rxpfxmfjl11vgvlkjcbglg6fs7y"; - }) - ]; - config = { hardware.openrazer = { enable = true; From b188a5239c96c7dca1c55c540906358779fc9d53 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 13:28:05 +0200 Subject: [PATCH 191/218] outputs: use bultins.toString for the default value of selfPath --- outputs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.nix b/outputs.nix index 48ad9b6..b26e229 100644 --- a/outputs.nix +++ b/outputs.nix @@ -1,7 +1,7 @@ { inputsPath ? ./inputs.nix, inputs ? import inputsPath {}, - selfPath ? ./. + selfPath ? builtins.toString ./., }: let From 5cedeec18c51c5dec8a7c3e750dedb8a5fea7a94 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 18:37:34 +0200 Subject: [PATCH 192/218] pkgs/den-http-get-updater: support list to prefetch --- inputs.nix | 48 ++++++----- .../de/den-http-get-updater/package.nix | 85 ++++++++++++++----- 2 files changed, 90 insertions(+), 43 deletions(-) diff --git a/inputs.nix b/inputs.nix index 1c6c039..78f008c 100644 --- a/inputs.nix +++ b/inputs.nix @@ -10,14 +10,16 @@ let self = { url = "https://github.com/nix-community/nixos-vscode-server/archive/${lock.nixos-vscode-server.revision}.tar.gz"; updateScript = pkgs.den-http-get-updater { fileLocation = lockFile; - previousHash = lock.nixos-vscode-server.sha256; previousVersion = lock.nixos-vscode-server.revision; versionUrl = "https://api.github.com/repos/nix-community/nixos-vscode-server/commits"; contentParser = "jq -rc '.[0].sha' <<< \"$newVersion\""; - prefetchUrlLocation = { - file = ./inputs.nix; - attrpath = "nixos-vscode-server.url"; - }; + prefetchList = [{ + previousHash = lock.nixos-vscode-server.sha256; + prefetchUrlLocation = { + file = ./inputs.nix; + attrpath = "nixos-vscode-server.url"; + }; + }]; }; outPath = builtins.fetchTarball { inherit url; @@ -29,13 +31,15 @@ let self = { url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs.revision}.tar.gz"; updateScript = pkgs.den-http-get-updater { fileLocation = lockFile; - previousHash = lock.nixpkgs.sha256; previousVersion = lock.nixpkgs.revision; versionUrl = "https://channels.nixos.org/nixos-24.11/git-revision"; - prefetchUrlLocation = { - file = ./inputs.nix; - attrpath = "nixpkgs.url"; - }; + prefetchList = [{ + previousHash = lock.nixpkgs.sha256; + prefetchUrlLocation = { + file = ./inputs.nix; + attrpath = "nixpkgs.url"; + }; + }]; }; outPath = builtins.fetchTarball { inherit url; @@ -47,13 +51,15 @@ let self = { url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs-unstable.revision}.tar.gz"; updateScript = pkgs.den-http-get-updater { fileLocation = lockFile; - previousHash = lock.nixpkgs-unstable.sha256; previousVersion = lock.nixpkgs-unstable.revision; versionUrl = "https://channels.nixos.org/nixos-unstable/git-revision"; - prefetchUrlLocation = { - file = ./inputs.nix; - attrpath = "nixpkgs-unstable.url"; - }; + prefetchList = [{ + previousHash = lock.nixpkgs-unstable.sha256; + prefetchUrlLocation = { + file = ./inputs.nix; + attrpath = "nixpkgs-unstable.url"; + }; + }]; }; outPath = builtins.fetchTarball { inherit url; @@ -65,14 +71,16 @@ let self = { url = "https://github.com/lilyinstarlight/nixos-cosmic/archive/${lock.cosmic-modules.revision}.tar.gz"; updateScript = pkgs.den-http-get-updater { fileLocation = lockFile; - previousHash = lock.cosmic-modules.sha256; previousVersion = lock.cosmic-modules.revision; versionUrl = "https://api.github.com/repos/lilyinstarlight/nixos-cosmic/commits"; contentParser = "jq -rc '.[0].sha' <<< \"$newVersion\""; - prefetchUrlLocation = { - file = ./inputs.nix; - attrpath = "cosmic-modules.url"; - }; + prefetchList = [{ + previousHash = lock.cosmic-modules.sha256; + prefetchUrlLocation = { + file = ./inputs.nix; + attrpath = "cosmic-modules.url"; + }; + }]; }; outPath = builtins.fetchTarball { inherit url; diff --git a/pkgs/by-name/de/den-http-get-updater/package.nix b/pkgs/by-name/de/den-http-get-updater/package.nix index d22b0ac..939c18f 100644 --- a/pkgs/by-name/de/den-http-get-updater/package.nix +++ b/pkgs/by-name/de/den-http-get-updater/package.nix @@ -11,10 +11,20 @@ { # location of file to modify fileLocation, - previousHash, previousVersion, versionUrl, - prefetchUrlLocation ? null, + + # { + # fileLocation: string?; + # previousHash: string; + # prefetchUrlLocation: { + # file: string; + # attrpath: string[]' + # }; + # }[] + # + prefetchList ? [], + # change newVersion variable in it, if the contents of the page # is not plaintext version # (json for example) @@ -24,23 +34,30 @@ name ? if unpack then "source" else null, }: -assert builtins.isNull prefetchUrlLocation || lib.isAttrs prefetchUrlLocation; -assert lib.isAttrs prefetchUrlLocation && ( - lib.isString prefetchUrlLocation.file or null || - lib.isPath prefetchUrlLocation.file or null -); -assert lib.isAttrs prefetchUrlLocation && lib.isString prefetchUrlLocation.attrpath or null; - let realFileLocation = builtins.toString fileLocation; - mark = builtins.hashString "sha256" previousHash; - mark' = lib.escapeShellArg mark; - prefetchUrlLocation' = lib.mapAttrs (_: lib.escapeShellArg) prefetchUrlLocation; + prefetchList' = lib.map (x: + assert builtins.isNull x.prefetchUrlLocation || lib.isAttrs x.prefetchUrlLocation; + assert lib.isAttrs x.prefetchUrlLocation && ( + lib.isString x.prefetchUrlLocation.file or null || + lib.isPath x.prefetchUrlLocation.file or null + ); + assert lib.isAttrs x.prefetchUrlLocation && lib.isString x.prefetchUrlLocation.attrpath or null; + rec { + inherit fileLocation; + mark = builtins.hashString "sha256" x.previousHash; + markShellEscape = lib.escapeShellArg mark; + markShellRegexEscape = lib.escapeShellArg (lib.escapeRegex mark); + realFileLocation = builtins.toString x.fileLocation or fileLocation; + realFileLocationShellEscape = lib.escapeShellArg realFileLocation; + prefetchUrlLocationShellEscape = lib.mapAttrs (_: lib.escapeShellArg) x.prefetchUrlLocation; + previousHashShellRegexEscape = lib.escapeShellArg (lib.escapeRegex x.previousHash); + } // x) prefetchList; + realFileLocation' = lib.escapeShellArg realFileLocation; versionUrl' = lib.escapeShellArg versionUrl; - mark'' = lib.escapeShellArg (lib.escapeRegex mark); previousVersion'' = lib.escapeShellArg (lib.escapeRegex previousVersion); nixUnpack = lib.optionalString unpack "--unpack"; @@ -56,6 +73,7 @@ in writeScript "den-http-get-updater" ('' PATH="${lib.escapeShellArg path}" + prefetchFailed= newVersion=$(curl -L "${versionUrl'}") if [[ "$?" != 0 ]]; then @@ -63,15 +81,30 @@ writeScript "den-http-get-updater" ('' exit 1 fi newVersion=$(${contentParser}) - awk -i inplace "{ - sub(/${previousVersion''}/, \"$newVersion\") - # invalidate hash - sub(/${previousHash}/, \"${mark'}\") - }1" "${realFileLocation'}" -'' + lib.optionalString (!builtins.isNull prefetchUrlLocation) '' + awk -i inplace "{ sub(/${previousVersion''}/, \"$newVersion\") }1" "${realFileLocation'}" +'' + +# invalidate hashes ++ lib.concatStringsSep "\n" (lib.map ({ + markShellEscape, + previousHash, + previousHashShellRegexEscape, + realFileLocationShellEscape, + ... +}: '' + awk -i inplace "{ sub(/${previousHashShellRegexEscape}/, \"${markShellEscape}\") }1" "${realFileLocationShellEscape}" +'') prefetchList') + ++ lib.concatStringsSep "\n" (lib.map ({ + fileLocation, + markShellRegexEscape, + prefetchUrlLocationShellEscape, + realFileLocationShellEscape, + ... +}: '' nixUrlsResult=$(nix-instantiate --eval --json \ - "${prefetchUrlLocation'.file}" \ - -A "${prefetchUrlLocation'.attrpath}" + "${prefetchUrlLocationShellEscape.file}" \ + -A "${prefetchUrlLocationShellEscape.attrpath}" ) urlsType=$(jq -rc 'type' <<< "$nixUrlsResult") @@ -93,14 +126,20 @@ writeScript "den-http-get-updater" ('' echo "prefetch succeeded!" echo "hash: $expectedHash" awk -i inplace "{ - sub(/${mark''}/, \"$expectedHash\") - }1" "${realFileLocation'}" + sub(/${markShellRegexEscape}/, \"$expectedHash\") + }1" "${realFileLocationShellEscape}" prefetchSucceeded= break fi done if [[ -n "$prefetchSucceeded" ]]; then echo "warning: prefetch failed" 1>&2 + prefetchFailed=1 + fi +'') (lib.filter (x: !builtins.isNull x.prefetchUrlLocation) prefetchList')) + ++ '' + if [[ -n "$prefetchFailed" ]]; then exit 1 fi '') From 1ade7631610309eae7fb4a4e60ef2cb2fabdc85d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 19:41:27 +0200 Subject: [PATCH 193/218] pkgs/den-http-get-updater: add extraPackages argument useful for contentParser argument --- pkgs/by-name/de/den-http-get-updater/package.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/de/den-http-get-updater/package.nix b/pkgs/by-name/de/den-http-get-updater/package.nix index 939c18f..fe71697 100644 --- a/pkgs/by-name/de/den-http-get-updater/package.nix +++ b/pkgs/by-name/de/den-http-get-updater/package.nix @@ -25,6 +25,9 @@ # prefetchList ? [], + # extra packages to add to the path + extraPackages ? [], + # change newVersion variable in it, if the contents of the page # is not plaintext version # (json for example) @@ -63,12 +66,12 @@ let nixUnpack = lib.optionalString unpack "--unpack"; nixName = lib.optionalString (!builtins.isNull name) "--name \"${lib.escapeShellArg name}\""; - path = lib.makeBinPath [ + path = lib.makeBinPath ([ curl gawk jq nix - ]; + ] ++ extraPackages); in writeScript "den-http-get-updater" ('' From a361d016834af6ff64c02980eb2b51cd671579c6 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 19:42:09 +0200 Subject: [PATCH 194/218] pkgs/den-http-get-updater: use strict evaluation --- pkgs/by-name/de/den-http-get-updater/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/de/den-http-get-updater/package.nix b/pkgs/by-name/de/den-http-get-updater/package.nix index fe71697..c9dc96d 100644 --- a/pkgs/by-name/de/den-http-get-updater/package.nix +++ b/pkgs/by-name/de/den-http-get-updater/package.nix @@ -105,7 +105,7 @@ writeScript "den-http-get-updater" ('' realFileLocationShellEscape, ... }: '' - nixUrlsResult=$(nix-instantiate --eval --json \ + nixUrlsResult=$(nix-instantiate --eval --json --strict \ "${prefetchUrlLocationShellEscape.file}" \ -A "${prefetchUrlLocationShellEscape.attrpath}" ) From 890260024f26a183597394336e2c786ecb674a0e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 21:06:21 +0200 Subject: [PATCH 195/218] pkgs/den-http-get-updater: use sed instead of awk --- .../de/den-http-get-updater/package.nix | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/pkgs/by-name/de/den-http-get-updater/package.nix b/pkgs/by-name/de/den-http-get-updater/package.nix index c9dc96d..7a00d66 100644 --- a/pkgs/by-name/de/den-http-get-updater/package.nix +++ b/pkgs/by-name/de/den-http-get-updater/package.nix @@ -2,7 +2,7 @@ lib, curl, - gawk, + gnused, jq, nix, writeScript, @@ -50,25 +50,24 @@ let rec { inherit fileLocation; mark = builtins.hashString "sha256" x.previousHash; - markShellEscape = lib.escapeShellArg mark; - markShellRegexEscape = lib.escapeShellArg (lib.escapeRegex mark); + markRegexEscape = lib.escapeRegex mark; realFileLocation = builtins.toString x.fileLocation or fileLocation; realFileLocationShellEscape = lib.escapeShellArg realFileLocation; prefetchUrlLocationShellEscape = lib.mapAttrs (_: lib.escapeShellArg) x.prefetchUrlLocation; - previousHashShellRegexEscape = lib.escapeShellArg (lib.escapeRegex x.previousHash); + previousHashRegexEscape = lib.escapeRegex x.previousHash; } // x) prefetchList; - realFileLocation' = lib.escapeShellArg realFileLocation; - versionUrl' = lib.escapeShellArg versionUrl; + realFileLocationShellEscape = lib.escapeShellArg realFileLocation; + versionUrlShellEscape = lib.escapeShellArg versionUrl; - previousVersion'' = lib.escapeShellArg (lib.escapeRegex previousVersion); + previousVersionRegexEscape = lib.escapeRegex previousVersion; nixUnpack = lib.optionalString unpack "--unpack"; nixName = lib.optionalString (!builtins.isNull name) "--name \"${lib.escapeShellArg name}\""; path = lib.makeBinPath ([ curl - gawk + gnused jq nix ] ++ extraPackages); @@ -78,29 +77,29 @@ writeScript "den-http-get-updater" ('' PATH="${lib.escapeShellArg path}" prefetchFailed= - newVersion=$(curl -L "${versionUrl'}") + newVersion=$(curl -L "${versionUrlShellEscape}") if [[ "$?" != 0 ]]; then echo "error: fetching new version failed" 1>&2 exit 1 fi newVersion=$(${contentParser}) - awk -i inplace "{ sub(/${previousVersion''}/, \"$newVersion\") }1" "${realFileLocation'}" + sed -Ei "s!${previousVersionRegexEscape}!$newVersion!g" "${realFileLocationShellEscape}" '' # invalidate hashes + lib.concatStringsSep "\n" (lib.map ({ - markShellEscape, + mark, previousHash, - previousHashShellRegexEscape, + previousHashRegexEscape, realFileLocationShellEscape, ... }: '' - awk -i inplace "{ sub(/${previousHashShellRegexEscape}/, \"${markShellEscape}\") }1" "${realFileLocationShellEscape}" + sed -Ei "s!${previousHashRegexEscape}!${mark}!g" "${realFileLocationShellEscape}" '') prefetchList') + lib.concatStringsSep "\n" (lib.map ({ fileLocation, - markShellRegexEscape, + markRegexEscape, prefetchUrlLocationShellEscape, realFileLocationShellEscape, ... @@ -128,9 +127,7 @@ writeScript "den-http-get-updater" ('' if [[ -n $expectedHash ]]; then echo "prefetch succeeded!" echo "hash: $expectedHash" - awk -i inplace "{ - sub(/${markShellRegexEscape}/, \"$expectedHash\") - }1" "${realFileLocationShellEscape}" + sed -Ei "s!${markRegexEscape}!$expectedHash!g" "${realFileLocationShellEscape}" prefetchSucceeded= break fi From 517ca95d8d0f775af33cfcb10c7f8784f548c2a2 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 21:16:20 +0200 Subject: [PATCH 196/218] pkgs/den-http-get-updater: support providing target hash --- pkgs/by-name/de/den-http-get-updater/package.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/de/den-http-get-updater/package.nix b/pkgs/by-name/de/den-http-get-updater/package.nix index 7a00d66..b6ba547 100644 --- a/pkgs/by-name/de/den-http-get-updater/package.nix +++ b/pkgs/by-name/de/den-http-get-updater/package.nix @@ -21,6 +21,8 @@ # file: string; # attrpath: string[]' # }; + # prefetchHash: string?; + # targetHash: string?; # }[] # prefetchList ? [], @@ -34,6 +36,8 @@ contentParser ? "echo \"$newVersion\"", unpack ? true, + hashAlgo ? "sha256", + hashFormat ? "sri", name ? if unpack then "source" else null, }: @@ -48,7 +52,7 @@ let ); assert lib.isAttrs x.prefetchUrlLocation && lib.isString x.prefetchUrlLocation.attrpath or null; rec { - inherit fileLocation; + inherit fileLocation hashAlgo hashFormat; mark = builtins.hashString "sha256" x.previousHash; markRegexEscape = lib.escapeRegex mark; realFileLocation = builtins.toString x.fileLocation or fileLocation; @@ -123,7 +127,12 @@ writeScript "den-http-get-updater" ('' prefetchSucceeded=1 for url in "''${prefetchUrls[@]}"; do echo "trying prefetch '$url'..."; - expectedHash=$(nix-prefetch-url "$url" ${nixUnpack} ${nixName}) + expectedHash=$(nix-prefetch-url "$url" ${nixUnpack} ${nixName} --type "${hashAlgo}") + expectedHash=$(nix --extra-experimental-features "nix-command" hash convert \ + --hash-algo "${hashAlgo}" \ + --to "${hashFormat}" \ + "$expectedHash" + ) if [[ -n $expectedHash ]]; then echo "prefetch succeeded!" echo "hash: $expectedHash" From 735a41ca0fd13a2b32e6c14a356163c05351193d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 21:42:19 +0200 Subject: [PATCH 197/218] pkgs/den-http-get-updater: allow to provide unpack and name argument per prefetch --- pkgs/by-name/de/den-http-get-updater/package.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/de/den-http-get-updater/package.nix b/pkgs/by-name/de/den-http-get-updater/package.nix index b6ba547..484fa35 100644 --- a/pkgs/by-name/de/den-http-get-updater/package.nix +++ b/pkgs/by-name/de/den-http-get-updater/package.nix @@ -23,6 +23,8 @@ # }; # prefetchHash: string?; # targetHash: string?; + # unpack: bool?; + # name: string?; # }[] # prefetchList ? [], @@ -38,7 +40,6 @@ unpack ? true, hashAlgo ? "sha256", hashFormat ? "sri", - name ? if unpack then "source" else null, }: let @@ -52,7 +53,8 @@ let ); assert lib.isAttrs x.prefetchUrlLocation && lib.isString x.prefetchUrlLocation.attrpath or null; rec { - inherit fileLocation hashAlgo hashFormat; + inherit fileLocation hashAlgo hashFormat unpack; + name = if x.unpack or unpack then "source" else null; mark = builtins.hashString "sha256" x.previousHash; markRegexEscape = lib.escapeRegex mark; realFileLocation = builtins.toString x.fileLocation or fileLocation; @@ -66,8 +68,6 @@ let previousVersionRegexEscape = lib.escapeRegex previousVersion; - nixUnpack = lib.optionalString unpack "--unpack"; - nixName = lib.optionalString (!builtins.isNull name) "--name \"${lib.escapeShellArg name}\""; path = lib.makeBinPath ([ curl @@ -104,10 +104,15 @@ writeScript "den-http-get-updater" ('' + lib.concatStringsSep "\n" (lib.map ({ fileLocation, markRegexEscape, + name, prefetchUrlLocationShellEscape, realFileLocationShellEscape, + unpack, ... -}: '' +}: let + nixUnpack = lib.optionalString unpack "--unpack"; + nixName = lib.optionalString (!builtins.isNull name) "--name \"${lib.escapeShellArg name}\""; +in '' nixUrlsResult=$(nix-instantiate --eval --json --strict \ "${prefetchUrlLocationShellEscape.file}" \ -A "${prefetchUrlLocationShellEscape.attrpath}" From 5bddee458869053b44fc46137c98d780de4dde26 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 21:56:41 +0200 Subject: [PATCH 198/218] nixos/nvidia: add updater for the driver package --- nix-os/nvidia.nix | 89 ++++++++++++++++++++++++++++++++++++++++++----- update-list.nix | 23 ++++++++++++ 2 files changed, 103 insertions(+), 9 deletions(-) diff --git a/nix-os/nvidia.nix b/nix-os/nvidia.nix index a9433f3..5da8b1d 100644 --- a/nix-os/nvidia.nix +++ b/nix-os/nvidia.nix @@ -1,4 +1,10 @@ -{ config, lib, pkgs, ...}: +{ + config, + lib, + pkgs, + self, + ... +}: { config = { @@ -16,14 +22,79 @@ powerManagement.enable = true; open = false; nvidiaSettings = true; - package = config.boot.kernelPackages.nvidiaPackages.mkDriver { - version = "570.133.07"; - sha256_64bit = "sha256-LUPmTFgb5e9VTemIixqpADfvbUX1QoTT2dztwI3E3CY="; - sha256_aarch64 = "sha256-yTovUno/1TkakemRlNpNB91U+V04ACTMwPEhDok7jI0="; - openSha256 = "sha256-9l8N83Spj0MccA8+8R1uqiXBS0Ag4JrLPjrU3TaXHnM="; - settingsSha256 = "sha256-XMk+FvTlGpMquM8aE8kgYK2PIEszUZD2+Zmj2OpYrzU="; - persistencedSha256 = "sha256-G1V7JtHQbfnSRfVjz/LE2fYTlh9okpCbE4dfX9oYSg8="; - }; + package = let + mkDriverArgs = { + version = "570.133.07"; + sha256_64bit = "sha256-LUPmTFgb5e9VTemIixqpADfvbUX1QoTT2dztwI3E3CY="; + sha256_aarch64 = "sha256-yTovUno/1TkakemRlNpNB91U+V04ACTMwPEhDok7jI0="; + openSha256 = "sha256-9l8N83Spj0MccA8+8R1uqiXBS0Ag4JrLPjrU3TaXHnM="; + settingsSha256 = "sha256-XMk+FvTlGpMquM8aE8kgYK2PIEszUZD2+Zmj2OpYrzU="; + persistencedSha256 = "sha256-G1V7JtHQbfnSRfVjz/LE2fYTlh9okpCbE4dfX9oYSg8="; + }; + in ( config.boot.kernelPackages.nvidiaPackages.mkDriver mkDriverArgs ).overrideAttrs (super: { + passthru = super.passthru or {} // { + urls = { + x86_64 = [ + "https://download.nvidia.com/XFree86/Linux-x86_64/${mkDriverArgs.version}/NVIDIA-Linux-x86_64-${mkDriverArgs.version}.run" + "https://us.download.nvidia.com/XFree86/Linux-x86_64/${mkDriverArgs.version}/NVIDIA-Linux-x86_64-${mkDriverArgs.version}.run" + ]; + aarch64 = [ + "https://us.download.nvidia.com/XFree86/aarch64/${mkDriverArgs.version}/NVIDIA-Linux-aarch64-${mkDriverArgs.version}.run" + "https://download.nvidia.com/XFree86/Linux-aarch64/${mkDriverArgs.version}/NVIDIA-Linux-aarch64-${mkDriverArgs.version}.run" + ]; + }; + updateScript = pkgs.den-http-get-updater { + fileLocation = ( builtins.unsafeGetAttrPos "any" { any = null; } ).file; + previousVersion = mkDriverArgs.version; + versionUrl = "https://raw.githubusercontent.com/aaronp24/nvidia-versions/master/nvidia-versions.txt"; + extraPackages = with pkgs; [ + coreutils + gawk + gnugrep + ]; + contentParser = lib.concatStringsSep " | " [ + "echo \"$newVersion\"" + "grep current" + "awk '{print $3}'" + "sort -V" + "tail -n 1" + ]; + unpack = false; + prefetchList = lib.map (x: { + inherit (x) previousHash; + unpack = x.unpack or true; + prefetchUrlLocation = { + file = builtins.toString self + "/outputs.nix"; + # TODO: don't use already existing NixOS configuration + attrpath = "nixosConfigurations.main.config.hardware.nvidia.package.${x.locationAttrpath}"; + }; + }) [ + { + previousHash = mkDriverArgs.sha256_64bit; + locationAttrpath = "urls.x86_64"; + unpack = false; + } + { + previousHash = mkDriverArgs.sha256_aarch64; + locationAttrpath = "urls.aarch64"; + unpack = false; + } + { + previousHash = mkDriverArgs.openSha256; + locationAttrpath = "open.src.urls"; + } + { + previousHash = mkDriverArgs.settingsSha256; + locationAttrpath = "settings.src.urls"; + } + { + previousHash = mkDriverArgs.persistencedSha256; + locationAttrpath = "persistenced.src.urls"; + } + ]; + }; + }; + }); }; nixpkgs.config.nvidia.acceptLicense = true; }; diff --git a/update-list.nix b/update-list.nix index 9ce74c3..eaaa200 100644 --- a/update-list.nix +++ b/update-list.nix @@ -11,3 +11,26 @@ in { "inputs/cosmic-modules" = inputsWithPackages.cosmic-modules; "inputs/nixos-vscode-server" = inputsWithPackages.nixos-vscode-server; }) + +# MARK: NixOS modules +// ( let + pkgs = self.modifiedNixpkgsPure { + localSystem = builtins.currentSystem; + config.allowUnfree = true; + }; + lib = pkgs.lib; + mkUpdater = path: attrpath: extraModule: let + system = pkgs.nixos { + imports = [ path extraModule ]; + config = { + _module.args = { + inherit self; + inherit (self) inputs; + }; + system.stateVersion = lib.versions.pad 2 lib.trivial.verison; + }; + }; + in lib.getAttrFromPath ( [ "config" ] ++ attrpath ) system; +in { + "NixOS/nvidia" = mkUpdater ./nix-os/nvidia.nix [ "hardware" "nvidia" "package" ] {}; +}) From 837b3d1b9618666061692daf1527ad3620dc6b2f Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 22:14:57 +0200 Subject: [PATCH 199/218] outputs.nix: fix path handling --- outputs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.nix b/outputs.nix index b26e229..41e50d6 100644 --- a/outputs.nix +++ b/outputs.nix @@ -60,7 +60,7 @@ self = { ( lib.filterAttrs (name: type: ( (type == "regular" && lib.hasSuffix ".nix" name) - || (type == "directory" && builtins.pathExists "${./.}/hosts/${name}/default.nix") + || (type == "directory" && builtins.pathExists "${builtins.toString ./.}/hosts/${name}/default.nix") ) && !lib.hasPrefix "." name )) From 0abc5cc90f399121d8d32b5766a167c354bcafb7 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 22:29:56 +0200 Subject: [PATCH 200/218] outputs: expose updateList --- outputs.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/outputs.nix b/outputs.nix index 41e50d6..4146c0f 100644 --- a/outputs.nix +++ b/outputs.nix @@ -73,6 +73,7 @@ self = { builtins.attrValues builtins.listToAttrs ]; + updateList = import ./update-list.nix self; # FIXME: currently impure # NOTE: to run, you need to evaluate outputs.nix instead of default.nix # nix-shell outputs.nix -A update @@ -80,9 +81,7 @@ self = { updateScript = (self.packagesForSystem (builtins.currentSystem)).den-update-script; in updateScript { path = ""; - packages = lib.pipe ./update-list.nix [ - import - (x: x self) + packages = lib.pipe self.updateList [ lib.attrsToList (lib.imap1 (i: {name, value}: { name = builtins.toString i; From 1cda1638c4cab9ee2a7dd15a30286dcdda804c86 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 8 Apr 2025 12:45:26 +0200 Subject: [PATCH 201/218] lock: update --- lock.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lock.nix b/lock.nix index 923222a..90657f6 100644 --- a/lock.nix +++ b/lock.nix @@ -1,18 +1,18 @@ { nixos-vscode-server = { revision = "8b6db451de46ecf9b4ab3d01ef76e59957ff549f"; - sha256 = "09j4kvsxw1d5dvnhbsgih0icbrxqv90nzf0b589rb5z6gnzwjnqf"; + sha256 = "sha256-DlvJv33ml5UTKgu4b0HauOfFIoDx6QXtbqUF3vWeRCY="; }; nixpkgs = { - revision = "bdb91860de2f719b57eef819b5617762f7120c70"; - sha256 = "16qxwcv06kimml219dp69dj83nf7wdfskvysnszaqyn40868nlmk"; + revision = "a880f49904d68b5e53338d1e8c7bf80f59903928"; + sha256 = "sha256-o4FjFOUmjSRMK7dn0TFdAT0RRWUWD+WsspPHa+qEQT8="; }; nixpkgs-unstable = { - revision = "42a1c966be226125b48c384171c44c651c236c22"; - sha256 = "082dpl311xlspwm5l3h2hf10ww6l59m7k2g2hdrqs4kwwsj9x6mf"; + revision = "063dece00c5a77e4a0ea24e5e5a5bd75232806f8"; + sha256 = "sha256-nEo1t3Q0F+0jQ36HJfbJtiRU4OI+/0jX/iITURKe3EE="; }; cosmic-modules = { - revision = "da24e5b3ed611c542ea63dee094f0beb29dcd7ad"; - sha256 = "10sd8f9kyz3cv1ngnr0s6zwckllsv0hisrrpkfz1bcqn2mwpqy59"; + revision = "14411c86d9af8e654e5a1608cc891e4e26f07b2f"; + sha256 = "sha256-TjRL6QnmOc3tXEJxkH/ThLem8R4g8YsGzAbvoDMW2Q4="; }; } From 80cb27a6186199dba8a723f4c2710794de992561 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 9 Apr 2025 12:54:16 +0200 Subject: [PATCH 202/218] pkgs/den-http-get-updater: try evaluate urlLocation multiple times --- .../de/den-http-get-updater/package.nix | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/de/den-http-get-updater/package.nix b/pkgs/by-name/de/den-http-get-updater/package.nix index 484fa35..106451a 100644 --- a/pkgs/by-name/de/den-http-get-updater/package.nix +++ b/pkgs/by-name/de/den-http-get-updater/package.nix @@ -113,10 +113,21 @@ writeScript "den-http-get-updater" ('' nixUnpack = lib.optionalString unpack "--unpack"; nixName = lib.optionalString (!builtins.isNull name) "--name \"${lib.escapeShellArg name}\""; in '' - nixUrlsResult=$(nix-instantiate --eval --json --strict \ - "${prefetchUrlLocationShellEscape.file}" \ - -A "${prefetchUrlLocationShellEscape.attrpath}" - ) + for i in {{ 1..30 }}; do + nixUrlsResult=$(nix-instantiate --eval --json --strict \ + "${prefetchUrlLocationShellEscape.file}" \ + -A "${prefetchUrlLocationShellEscape.attrpath}" + ) + if [[ "$?" == "0" ]]; then + break + elif [[ "$i" == 30 ]]; then + echo "error: prefetchUrlLocation failed - attempts exhausted" 1>&2 + exit 1 + fi + echo "prefetchUrlLocation failed (attempt $i)" 1>&2 + sleep 2 + done + urlsType=$(jq -rc 'type' <<< "$nixUrlsResult") if [ "$urlsType" = "array" ]; then From 45a9ced99b0acbf73b15feccaf5538d4f5f56f0e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 9 Apr 2025 12:54:27 +0200 Subject: [PATCH 203/218] lock: update --- lock.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lock.nix b/lock.nix index 90657f6..b11d9d3 100644 --- a/lock.nix +++ b/lock.nix @@ -8,11 +8,11 @@ sha256 = "sha256-o4FjFOUmjSRMK7dn0TFdAT0RRWUWD+WsspPHa+qEQT8="; }; nixpkgs-unstable = { - revision = "063dece00c5a77e4a0ea24e5e5a5bd75232806f8"; - sha256 = "sha256-nEo1t3Q0F+0jQ36HJfbJtiRU4OI+/0jX/iITURKe3EE="; + revision = "c8cd81426f45942bb2906d5ed2fe21d2f19d95b7"; + sha256 = "sha256-tzCdyIJj9AjysC3OuKA+tMD/kDEDAF9mICPDU7ix0JA="; }; cosmic-modules = { - revision = "14411c86d9af8e654e5a1608cc891e4e26f07b2f"; - sha256 = "sha256-TjRL6QnmOc3tXEJxkH/ThLem8R4g8YsGzAbvoDMW2Q4="; + revision = "d20b15f629985fe6900925bef462f947e4a75b2f"; + sha256 = "sha256-KEuKL7lM2ZqKzvaGIptVDAce29CAR4ZSgWtFD3PnpB0="; }; } From 909955098df9c68f6d6ce088f115ebf2ba12b2ec Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 10 Apr 2025 16:12:40 +0200 Subject: [PATCH 204/218] inputs: add nix-bitcoin --- inputs.nix | 21 +++++++++++++++++++++ lock.nix | 4 ++++ update-list.nix | 1 + 3 files changed, 26 insertions(+) diff --git a/inputs.nix b/inputs.nix index 78f008c..7f043b0 100644 --- a/inputs.nix +++ b/inputs.nix @@ -67,6 +67,27 @@ let self = { sha256 = "${lock.nixpkgs-unstable.sha256}"; }; }; + nix-bitcoin = rec { + url = "https://github.com/fort-nix/nix-bitcoin/archive/${lock.nix-bitcoin.revision}.tar.gz"; + updateScript = pkgs.den-http-get-updater { + fileLocation = lockFile; + previousVersion = lock.nix-bitcoin.revision; + versionUrl = "https://api.github.com/repos/fort-nix/nix-bitcoin/commits"; + contentParser = "jq -rc '.[0].sha' <<< \"$newVersion\""; + prefetchList = [{ + previousHash = lock.nix-bitcoin.sha256; + prefetchUrlLocation = { + file = ./inputs.nix; + attrpath = "nix-bitcoin.url"; + }; + }]; + }; + outPath = builtins.fetchTarball { + inherit url; + name = "nix-bitcoin"; + sha256 = "${lock.nix-bitcoin.sha256}"; + }; + }; cosmic-modules = rec { url = "https://github.com/lilyinstarlight/nixos-cosmic/archive/${lock.cosmic-modules.revision}.tar.gz"; updateScript = pkgs.den-http-get-updater { diff --git a/lock.nix b/lock.nix index b11d9d3..9f47d2f 100644 --- a/lock.nix +++ b/lock.nix @@ -11,6 +11,10 @@ revision = "c8cd81426f45942bb2906d5ed2fe21d2f19d95b7"; sha256 = "sha256-tzCdyIJj9AjysC3OuKA+tMD/kDEDAF9mICPDU7ix0JA="; }; + nix-bitcoin = { + revision = "990805aa7c7fcd1552c6e14e8c6df9a88ba9be41"; + sha256 = "sha256-yU7iYlDSD8lOrm02igxIl3y+bXGZDDO0qcG0gO48Cto="; + }; cosmic-modules = { revision = "d20b15f629985fe6900925bef462f947e4a75b2f"; sha256 = "sha256-KEuKL7lM2ZqKzvaGIptVDAce29CAR4ZSgWtFD3PnpB0="; diff --git a/update-list.nix b/update-list.nix index eaaa200..f846bcb 100644 --- a/update-list.nix +++ b/update-list.nix @@ -8,6 +8,7 @@ self: in { "inputs/nixpkgs" = inputsWithPackages.nixpkgs; "inputs/nixpkgs-unstable" = inputsWithPackages.nixpkgs-unstable; + "inputs/nix-bitcoin" = inputsWithPackages.nix-bitcoin; "inputs/cosmic-modules" = inputsWithPackages.cosmic-modules; "inputs/nixos-vscode-server" = inputsWithPackages.nixos-vscode-server; }) From 186affb97dbe8de7e323f5549694dff26a2ce46f Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 11 Apr 2025 19:39:25 +0200 Subject: [PATCH 205/218] hosts/main: add cryptocurrency module this is one of many services that I had hosted using docker --- hosts/main/cryptocurrency.nix | 57 +++++++++++++++++++++++++++++++++++ hosts/main/default.nix | 2 ++ 2 files changed, 59 insertions(+) create mode 100644 hosts/main/cryptocurrency.nix diff --git a/hosts/main/cryptocurrency.nix b/hosts/main/cryptocurrency.nix new file mode 100644 index 0000000..0523912 --- /dev/null +++ b/hosts/main/cryptocurrency.nix @@ -0,0 +1,57 @@ +{ + inputs, + ... +}: + +{ + imports = [ + "${inputs.nix-bitcoin}/modules/modules.nix" + ]; + + config = { + + services.bitcoind = { + enable = true; + listen = true; + txindex = true; + disablewallet = true; + extraConfig = '' + coinstatsindex=1 + maxmempool=2048 + persistmempool=1 + ''; + tor.proxy = true; + rpc.address = "0.0.0.0"; + rpc.allowip = [ + "10.0.0.0/8" + "172.16.0.0/12" + "192.168.0.0/16" + ]; + }; + + services.electrs = { + enable = true; + }; + + services.monero = { + enable = true; + extraConfig = '' + proxy=127.0.0.1:9050 + igd=disabled + ''; + }; + + services.tor.client.enable = true; + + nix-bitcoin = { + onionServices = { + bitcoind = { + public = true; + }; + }; + generateSecrets = true; + secretsDir = "/var/nix-bitcoin"; + configVersion = "0.0.121"; + }; + }; +} diff --git a/hosts/main/default.nix b/hosts/main/default.nix index 3b9807f..ed2ae20 100644 --- a/hosts/main/default.nix +++ b/hosts/main/default.nix @@ -26,6 +26,8 @@ ../../nix-os/gnupg.nix "${inputs.nixos-vscode-server}" + + ./cryptocurrency.nix ]; config = { From f7c217b26c87ea402e9e5506ccafef3ccd4ba5fd Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 12 Apr 2025 12:32:57 +0200 Subject: [PATCH 206/218] hosts: set system.stateVersion to 24.11 Yes, I read all changes that it would do using nix-diff --- hosts/main/default.nix | 2 +- hosts/tablet.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hosts/main/default.nix b/hosts/main/default.nix index ed2ae20..dd1458a 100644 --- a/hosts/main/default.nix +++ b/hosts/main/default.nix @@ -87,6 +87,6 @@ nixpkgs.hostPlatform = "x86_64-linux"; - system.stateVersion = "23.05"; + system.stateVersion = "24.11"; }; } diff --git a/hosts/tablet.nix b/hosts/tablet.nix index 7343cda..12b4780 100644 --- a/hosts/tablet.nix +++ b/hosts/tablet.nix @@ -54,7 +54,7 @@ nixpkgs.hostPlatform = "x86_64-linux"; - system.stateVersion = "23.11"; + system.stateVersion = "24.11"; }; } From d5922109aeedd8d8a81d81fe16f4a8202040cf7e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 12 Apr 2025 12:43:31 +0200 Subject: [PATCH 207/218] hosts/main: enable mariadb --- hosts/main/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hosts/main/default.nix b/hosts/main/default.nix index dd1458a..486c359 100644 --- a/hosts/main/default.nix +++ b/hosts/main/default.nix @@ -81,6 +81,12 @@ package = pkgs.unstable.ollama; host = "0.0.0.0"; }; + + services.mysql = { + enable = true; + package = pkgs.mariadb; + }; + environment.sessionVariables = { OLLAMA_HOST = "127.0.0.1:${builtins.toString config.services.ollama.port}"; }; From f2d894d0a2e057e649efafb034cb0bdcabccee6f Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 13 Apr 2025 10:45:43 +0200 Subject: [PATCH 208/218] lock: update --- lock.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lock.nix b/lock.nix index 9f47d2f..8ee15cc 100644 --- a/lock.nix +++ b/lock.nix @@ -4,19 +4,19 @@ sha256 = "sha256-DlvJv33ml5UTKgu4b0HauOfFIoDx6QXtbqUF3vWeRCY="; }; nixpkgs = { - revision = "a880f49904d68b5e53338d1e8c7bf80f59903928"; - sha256 = "sha256-o4FjFOUmjSRMK7dn0TFdAT0RRWUWD+WsspPHa+qEQT8="; + revision = "f9ebe33a928b5d529c895202263a5ce46bdf12f7"; + sha256 = "sha256-QZnNHM823am8apCqKSPdtnzPGTy2ZB4zIXOVoBp5+W0="; }; nixpkgs-unstable = { - revision = "c8cd81426f45942bb2906d5ed2fe21d2f19d95b7"; - sha256 = "sha256-tzCdyIJj9AjysC3OuKA+tMD/kDEDAF9mICPDU7ix0JA="; + revision = "2631b0b7abcea6e640ce31cd78ea58910d31e650"; + sha256 = "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM="; }; nix-bitcoin = { revision = "990805aa7c7fcd1552c6e14e8c6df9a88ba9be41"; sha256 = "sha256-yU7iYlDSD8lOrm02igxIl3y+bXGZDDO0qcG0gO48Cto="; }; cosmic-modules = { - revision = "d20b15f629985fe6900925bef462f947e4a75b2f"; - sha256 = "sha256-KEuKL7lM2ZqKzvaGIptVDAce29CAR4ZSgWtFD3PnpB0="; + revision = "a76a451a2c97aa37a7741bdf8244ad91205776b8"; + sha256 = "sha256-xTaAboh9p0Mz0UEgcKe+B1zVKoRFG7RQR+gf7ypMQVA="; }; } From bc563b761340f76b1e7bf32c879869077480d84d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 17 Apr 2025 20:31:06 +0200 Subject: [PATCH 209/218] lock: update --- lock.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lock.nix b/lock.nix index 8ee15cc..dee1367 100644 --- a/lock.nix +++ b/lock.nix @@ -4,8 +4,8 @@ sha256 = "sha256-DlvJv33ml5UTKgu4b0HauOfFIoDx6QXtbqUF3vWeRCY="; }; nixpkgs = { - revision = "f9ebe33a928b5d529c895202263a5ce46bdf12f7"; - sha256 = "sha256-QZnNHM823am8apCqKSPdtnzPGTy2ZB4zIXOVoBp5+W0="; + revision = "26d499fc9f1d567283d5d56fcf367edd815dba1d"; + sha256 = "sha256-FHlSkNqFmPxPJvy+6fNLaNeWnF1lZSgqVCl/eWaJRc4="; }; nixpkgs-unstable = { revision = "2631b0b7abcea6e640ce31cd78ea58910d31e650"; @@ -16,7 +16,7 @@ sha256 = "sha256-yU7iYlDSD8lOrm02igxIl3y+bXGZDDO0qcG0gO48Cto="; }; cosmic-modules = { - revision = "a76a451a2c97aa37a7741bdf8244ad91205776b8"; - sha256 = "sha256-xTaAboh9p0Mz0UEgcKe+B1zVKoRFG7RQR+gf7ypMQVA="; + revision = "14bedf460c4d98b0f6358904965147c01ccb41fe"; + sha256 = "sha256-ka+DI/jnNLGOt4dbROv18m6MhqnQAgTTvezswYHuDoo="; }; } From 786529e7a4475a8c407e75ba8d516b33f472d939 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 23 Apr 2025 02:13:17 +0200 Subject: [PATCH 210/218] gitignore: update *-configuration.nix is no longer needed I hate seeing nix outputs being found by git --- .gitignore | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 456ec08..46302cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -device-configuration.nix -hardware-configuration.nix +repl-result-* result -*.qcow2 \ No newline at end of file +result-* +*.qcow2 From 6eb7a1cb19b6ac0cf88580b447c502a0a89edd47 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 23 Apr 2025 04:09:52 +0200 Subject: [PATCH 211/218] nixos/shell: add `nix-convert-hash` alias --- nix-os/shell.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nix-os/shell.nix b/nix-os/shell.nix index e30c9a7..3c6833a 100644 --- a/nix-os/shell.nix +++ b/nix-os/shell.nix @@ -27,12 +27,18 @@ in ]; config = { - environment.systemPackages = with pkgs; [ + environment.systemPackages = ( with pkgs; [ aliasDrag rangerGit ripgrep kitty zoxide + ]) ++ [ + ( + pkgs.writeScriptBin "nix-convert-hash" '' + ${lib.getExe' config.nix.package "nix"} --extra-experimental-features "nix-command" hash convert "$@" + '' + ) ]; programs.bash.shellInit = '' From 1334ea0a936e09d08c392827cf66e5e85422c07e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 23 Apr 2025 04:09:57 +0200 Subject: [PATCH 212/218] lock: update --- lock.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lock.nix b/lock.nix index dee1367..bfeabcd 100644 --- a/lock.nix +++ b/lock.nix @@ -4,19 +4,19 @@ sha256 = "sha256-DlvJv33ml5UTKgu4b0HauOfFIoDx6QXtbqUF3vWeRCY="; }; nixpkgs = { - revision = "26d499fc9f1d567283d5d56fcf367edd815dba1d"; - sha256 = "sha256-FHlSkNqFmPxPJvy+6fNLaNeWnF1lZSgqVCl/eWaJRc4="; + revision = "1eae3268880484be84199bdb77941c09bb4a97ba"; + sha256 = "sha256-1Sj8MToixDwakJYNMYBS/PYbg8Oa4CAxreXraMHB5qg="; }; nixpkgs-unstable = { - revision = "2631b0b7abcea6e640ce31cd78ea58910d31e650"; - sha256 = "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM="; + revision = "c11863f1e964833214b767f4a369c6e6a7aba141"; + sha256 = "sha256-GfpyMzxwkfgRVN0cTGQSkTC0OHhEkv3Jf6Tcjm//qZ0="; }; nix-bitcoin = { revision = "990805aa7c7fcd1552c6e14e8c6df9a88ba9be41"; sha256 = "sha256-yU7iYlDSD8lOrm02igxIl3y+bXGZDDO0qcG0gO48Cto="; }; cosmic-modules = { - revision = "14bedf460c4d98b0f6358904965147c01ccb41fe"; - sha256 = "sha256-ka+DI/jnNLGOt4dbROv18m6MhqnQAgTTvezswYHuDoo="; + revision = "84d7c1002734f21f150c641da095c5ce43f1cb98"; + sha256 = "sha256-Rbw+E3Na694sTPjNSRFHtT1o31eQXO3OLEzM+25kcME="; }; } From 73498bc6fd06f24b13859c9ccc17ca72e1836939 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 23 Apr 2025 04:10:03 +0200 Subject: [PATCH 213/218] nixos/nvidia: update --- nix-os/nvidia.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nix-os/nvidia.nix b/nix-os/nvidia.nix index 5da8b1d..afd3d33 100644 --- a/nix-os/nvidia.nix +++ b/nix-os/nvidia.nix @@ -24,12 +24,12 @@ nvidiaSettings = true; package = let mkDriverArgs = { - version = "570.133.07"; - sha256_64bit = "sha256-LUPmTFgb5e9VTemIixqpADfvbUX1QoTT2dztwI3E3CY="; - sha256_aarch64 = "sha256-yTovUno/1TkakemRlNpNB91U+V04ACTMwPEhDok7jI0="; - openSha256 = "sha256-9l8N83Spj0MccA8+8R1uqiXBS0Ag4JrLPjrU3TaXHnM="; - settingsSha256 = "sha256-XMk+FvTlGpMquM8aE8kgYK2PIEszUZD2+Zmj2OpYrzU="; - persistencedSha256 = "sha256-G1V7JtHQbfnSRfVjz/LE2fYTlh9okpCbE4dfX9oYSg8="; + version = "575.51.02"; + sha256_64bit = "sha256-XZ0N8ISmoAC8p28DrGHk/YN1rJsInJ2dZNL8O+Tuaa0="; + sha256_aarch64 = "sha256-NNeQU9sPfH1sq3d5RUq1MWT6+7mTo1SpVfzabYSVMVI="; + openSha256 = "sha256-NQg+QDm9Gt+5bapbUO96UFsPnz1hG1dtEwT/g/vKHkw="; + settingsSha256 = "sha256-6n9mVkEL39wJj5FB1HBml7TTJhNAhS/j5hqpNGFQE4w="; + persistencedSha256 = "sha256-dgmco+clEIY8bedxHC4wp+fH5JavTzyI1BI8BxoeJJI="; }; in ( config.boot.kernelPackages.nvidiaPackages.mkDriver mkDriverArgs ).overrideAttrs (super: { passthru = super.passthru or {} // { From 202bab9d5df2a42b830e12ffffc488afc6c56144 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 23 Apr 2025 12:08:22 +0200 Subject: [PATCH 214/218] nixos/core: enable nix's auto-optimise-store --- nix-os/core.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index a65ffe1..8d8c9b3 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -22,9 +22,12 @@ nixpkgs.config.allowUnfree = true; nix = { channel.enable = false; - settings.experimental-features = [ - "no-url-literals" - ]; + settings = { + auto-optimise-store = true; + experimental-features = [ + "no-url-literals" + ]; + }; nixPath = [ "nixpkgs=${pkgs.selfExpr { useConfig = false; }}" "systemNixpkgs=${pkgs.selfExpr { useConfig = true; name = "systemNixpkgs-self"; }}" From 0ae2504b5d7b5d1dd576f18e1b3a2e670cdd8a59 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 26 Apr 2025 13:41:51 +0200 Subject: [PATCH 215/218] lock: update --- lock.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lock.nix b/lock.nix index bfeabcd..7203ef8 100644 --- a/lock.nix +++ b/lock.nix @@ -4,19 +4,19 @@ sha256 = "sha256-DlvJv33ml5UTKgu4b0HauOfFIoDx6QXtbqUF3vWeRCY="; }; nixpkgs = { - revision = "1eae3268880484be84199bdb77941c09bb4a97ba"; - sha256 = "sha256-1Sj8MToixDwakJYNMYBS/PYbg8Oa4CAxreXraMHB5qg="; + revision = "5630cf13cceac06cefe9fc607e8dfa8fb342dde3"; + sha256 = "sha256-FQoi3R0NjQeBAsEOo49b5tbDPcJSMWc3QhhaIi9eddw="; }; nixpkgs-unstable = { - revision = "c11863f1e964833214b767f4a369c6e6a7aba141"; - sha256 = "sha256-GfpyMzxwkfgRVN0cTGQSkTC0OHhEkv3Jf6Tcjm//qZ0="; + revision = "f771eb401a46846c1aebd20552521b233dd7e18b"; + sha256 = "sha256-ITSpPDwvLBZBnPRS2bUcHY3gZSwis/uTe255QgMtTLA="; }; nix-bitcoin = { revision = "990805aa7c7fcd1552c6e14e8c6df9a88ba9be41"; sha256 = "sha256-yU7iYlDSD8lOrm02igxIl3y+bXGZDDO0qcG0gO48Cto="; }; cosmic-modules = { - revision = "84d7c1002734f21f150c641da095c5ce43f1cb98"; - sha256 = "sha256-Rbw+E3Na694sTPjNSRFHtT1o31eQXO3OLEzM+25kcME="; + revision = "48280c3737fee2db3a1226c297c86428417f552d"; + sha256 = "sha256-oUFoPmT2/ww1bIU0Vmifx9BdarVqlv9MyEIxUTqYJnM="; }; } From 9afdfdeeab356a7a8f6b971a6cff219d24303b0e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 26 Apr 2025 13:46:30 +0200 Subject: [PATCH 216/218] nixpkgs/overlays/cosmic-package: use nixpkgs-unstable from inputs instead of nixpkgs-unstable pinned in flake lock file --- pkgs/overlays/cosmic-packages.nix | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/pkgs/overlays/cosmic-packages.nix b/pkgs/overlays/cosmic-packages.nix index 5f34ffa..c41fdf0 100644 --- a/pkgs/overlays/cosmic-packages.nix +++ b/pkgs/overlays/cosmic-packages.nix @@ -8,21 +8,10 @@ self: super: let nixos-cosmic = inputs.cosmic-modules; - # Pinned unstable nixpkgs from cosmic-modules - cosmicModulesLock = builtins.fromJSON (builtins.readFile "${nixos-cosmic}/flake.lock"); - pinnedNixpkgsRev = cosmicModulesLock.nodes.nixpkgs.locked.rev; - pinnedNixpkgsNarHash = cosmicModulesLock.nodes.nixpkgs.locked.narHash; - - futureNixpkgsSrc = builtins.fetchTarball { - name = "nixpkgs"; - url = "https://github.com/NixOS/nixpkgs/archive/${pinnedNixpkgsRev}.tar.gz"; - sha256 = pinnedNixpkgsNarHash; - }; - - # Initialize pinned nixpkgs + # Initialize pinned unstable nixpkgs futureNixpkgs = let extended = self.extend (import ./unstable-from-source.nix { - unstableSource = futureNixpkgsSrc; + unstableSource = inputs.nixpkgs-unstable; }); in extended.unstable; in From 884a06bfe1bb9f64d7bb2f119d0501aa974a59e9 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 26 Apr 2025 13:47:48 +0200 Subject: [PATCH 217/218] inputs: move self binding into the body of the function --- inputs.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/inputs.nix b/inputs.nix index 7f043b0..088113b 100644 --- a/inputs.nix +++ b/inputs.nix @@ -1,10 +1,12 @@ -let self = { +{ lock ? import lockFile, lockFile ? ./lock.nix, pkgs ? throw "inputs called without pkgs", }: -{ +let + +self = { inherit lock; nixos-vscode-server = rec { url = "https://github.com/nix-community/nixos-vscode-server/archive/${lock.nixos-vscode-server.revision}.tar.gz"; @@ -110,4 +112,5 @@ let self = { }; }; }; + in self From 83fb160819bdc11a82acccb6584b303fcc08017f Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 27 Apr 2025 00:02:55 +0200 Subject: [PATCH 218/218] lock: set cosmic-modules lock to commit from my fork that is from https://github.com/amozeo/nixos-cosmic --- lock.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lock.nix b/lock.nix index 7203ef8..977be0b 100644 --- a/lock.nix +++ b/lock.nix @@ -16,7 +16,7 @@ sha256 = "sha256-yU7iYlDSD8lOrm02igxIl3y+bXGZDDO0qcG0gO48Cto="; }; cosmic-modules = { - revision = "48280c3737fee2db3a1226c297c86428417f552d"; - sha256 = "sha256-oUFoPmT2/ww1bIU0Vmifx9BdarVqlv9MyEIxUTqYJnM="; + revision = "998c6a241cf458adb98c214bbaca6cde0c01851b"; + sha256 = "sha256-2StppY6gXH8of4W9LBGS/e7XQL+rAr+p5LDyeSx6uTY="; }; }