From 152b3a9f5e95cca8b313726e06fa2046700fe3e4 Mon Sep 17 00:00:00 2001 From: Charlotte Van Petegem Date: Fri, 12 May 2023 16:10:21 +0200 Subject: [PATCH] Update dependencies --- flake.lock | 48 +++++--------- flake.nix | 121 +++++++++++++++++++---------------- modules/programs/default.nix | 2 +- 3 files changed, 83 insertions(+), 88 deletions(-) diff --git a/flake.lock b/flake.lock index e67741c7..9df1e24e 100644 --- a/flake.lock +++ b/flake.lock @@ -87,16 +87,19 @@ "agenix": { "inputs": { "darwin": "darwin", + "home-manager": [ + "home-manager" + ], "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1682101079, - "narHash": "sha256-MdAhtjrLKnk2uiqun1FWABbKpLH090oeqCSiWemtuck=", + "lastModified": 1683866323, + "narHash": "sha256-M2bEuh2jr0Ec13GnP5f8unD8q0AcPt2fHSUynOZJ8No=", "owner": "ryantm", "repo": "agenix", - "rev": "2994d002dcff5353ca1ac48ec584c7f6589fe447", + "rev": "92197270a1eedd142a4aff853e4cc6d1e838c22f", "type": "github" }, "original": { @@ -176,11 +179,11 @@ ] }, "locked": { - "lastModified": 1683828712, - "narHash": "sha256-frB0BacpjtmzDunFZwyRZSNlyOvcxpL0ohtQVvFtiA8=", + "lastModified": 1683886604, + "narHash": "sha256-VlviL7T8kKucNqVKiPR/9oqwq/AzGy/kIEBdBA5GzBQ=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "b0100f5fdc823be12bbcb31bcc5293fc74e04a56", + "rev": "c9266074575d3067996db265ff70362af9eb4c0b", "type": "github" }, "original": { @@ -230,11 +233,11 @@ ] }, "locked": { - "lastModified": 1683833146, - "narHash": "sha256-ELF0oXgg0NYGyKtU74HW8CeLstFJwwCGbuahnQla67I=", + "lastModified": 1683892466, + "narHash": "sha256-/zN3pQ4xoyolJoxrtn9oLU4JMjG5+c5K7BeLxZ7BR8o=", "owner": "nix-community", "repo": "home-manager", - "rev": "cc9f65d104e5227d103a529a9fc3687ef4ccb117", + "rev": "70c8bd08e6c186e5c628a4e5af6f7ad67cd344b8", "type": "github" }, "original": { @@ -322,11 +325,11 @@ }, "nur": { "locked": { - "lastModified": 1683841550, - "narHash": "sha256-nhZMbft7H1i0odTuar68kzTS1zlQpl7nBKEBOZehaOQ=", + "lastModified": 1683896271, + "narHash": "sha256-qF/GFquBc1D6zPmuzpaGC+LfwiM/SVwz6C0xNv+K/rE=", "owner": "nix-community", "repo": "NUR", - "rev": "b1729b9029f4a4f8b9cd08a2f84f6fc09e5cf2a3", + "rev": "1909bde2032156e9ff60e2deada4dd3c00b39e62", "type": "github" }, "original": { @@ -350,7 +353,6 @@ "nixpkgs": "nixpkgs", "nur": "nur", "tetris": "tetris", - "utils": "utils", "www-chvp-be": "www-chvp-be" } }, @@ -395,26 +397,6 @@ "type": "github" } }, - "utils": { - "inputs": { - "flake-utils": [ - "flake-utils" - ] - }, - "locked": { - "lastModified": 1657226504, - "narHash": "sha256-GIYNjuq4mJlFgqKsZ+YrgzWm0IpA4axA3MCrdKYj7gs=", - "owner": "gytis-ivaskevicius", - "repo": "flake-utils-plus", - "rev": "2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a", - "type": "github" - }, - "original": { - "owner": "gytis-ivaskevicius", - "repo": "flake-utils-plus", - "type": "github" - } - }, "www-chvp-be": { "inputs": { "devshell": [ diff --git a/flake.nix b/flake.nix index 9cd14779..d84d9dc9 100644 --- a/flake.nix +++ b/flake.nix @@ -30,7 +30,10 @@ }; agenix = { url = "github:ryantm/agenix"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs = { + home-manager.follows = "home-manager"; + nixpkgs.follows = "nixpkgs"; + }; }; devshell = { url = "github:chvp/devshell"; @@ -72,12 +75,6 @@ nixpkgs.follows = "nixpkgs"; }; }; - utils = { - url = "github:gytis-ivaskevicius/flake-utils-plus"; - inputs = { - flake-utils.follows = "flake-utils"; - }; - }; www-chvp-be = { url = "gitlab:chvp/www.chvp.be?host=git.chvp.be"; inputs = { @@ -88,55 +85,71 @@ }; }; - outputs = inputs@{ self, nixpkgs, accentor, accentor-api, accentor-web, agenix, devshell, emacs-overlay, flake-utils, home-manager, nix-index-database, nixos-mailserver, nur, tetris, utils, www-chvp-be }: - utils.lib.mkFlake { - inherit self inputs; - channels.nixpkgs = { - input = nixpkgs; - patches = builtins.map (patch: ./patches + "/${patch}") (builtins.filter (x: x != ".keep") (builtins.attrNames (builtins.readDir ./patches))); - overlaysBuilder = _: [ - agenix.overlays.default - accentor.overlays.default - devshell.overlays.default - emacs-overlay.overlay - (self: super: { - tetris = tetris.packages.${self.system}.default; - }) - nur.overlay - www-chvp-be.overlays.default + outputs = inputs@{ self, nixpkgs, accentor, accentor-api, accentor-web, agenix, devshell, emacs-overlay, flake-utils, home-manager, nix-index-database, nixos-mailserver, nur, tetris, www-chvp-be }: + let + patches = builtins.map (patch: ./patches + "/${patch}") (builtins.filter (x: x != ".keep") (builtins.attrNames (builtins.readDir ./patches))); + # Avoid IFD if there are no patches + nixpkgsForSystem = system: if patches == [ ] then inputs.nixpkgs else + ( + (import inputs.nixpkgs { inherit system; }).pkgs.applyPatches { + inherit patches; + name = "nixpkgs-patched-${inputs.nixpkgs.shortRev}"; + src = inputs.nixpkgs; + }); + overlays = [ + agenix.overlays.default + accentor.overlays.default + devshell.overlays.default + emacs-overlay.overlay + (self: super: { + tetris = tetris.packages.${self.system}.default; + }) + nur.overlay + www-chvp-be.overlays.default + ]; + baseModules = [ + accentor.nixosModules.default + agenix.nixosModules.age + home-manager.nixosModule + nixos-mailserver.nixosModule + nix-index-database.nixosModules.nix-index + ./modules + ]; + nixosSystem = system: name: nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = baseModules ++ [ + ({ config, ... }: + let nixpkgs = nixpkgsForSystem system; in + { + environment.etc.nixpkgs.source = nixpkgs; + nixpkgs.pkgs = import nixpkgs { inherit overlays system; config = config.nixpkgs.config; }; + networking.hostName = name; + nix = { + extraOptions = "extra-experimental-features = nix-command flakes"; + registry = builtins.mapAttrs (name: v: { flake = v; }) inputs; + }; + }) + ./machines/${name} ]; }; - hostDefaults = { - modules = [ - ({ channel, ... }: { - nix.generateRegistryFromInputs = true; - environment.etc."nixpkgs".source = channel.path; - }) - accentor.nixosModules.default - agenix.nixosModules.age - home-manager.nixosModule - nixos-mailserver.nixosModule - nix-index-database.nixosModules.nix-index - ./modules - ]; + nixosConfigurations = { + kharbranth = nixosSystem "x86_64-linux" "kharbranth"; + kholinar = nixosSystem "x86_64-linux" "kholinar"; + lasting-integrity = nixosSystem "x86_64-linux" "lasting-integrity"; + urithiru = nixosSystem "x86_64-linux" "urithiru"; }; - hosts = { - kharbranth.modules = [ ./machines/kharbranth ]; - kholinar.modules = [ ./machines/kholinar ]; - lasting-integrity.modules = [ ./machines/lasting-integrity ]; - urithiru.modules = [ ./machines/urithiru ]; - }; - outputsBuilder = channels: - let pkgs = channels.nixpkgs; in + lsShells = builtins.readDir ./shells; + shellFiles = builtins.filter (name: lsShells.${name} == "regular") (builtins.attrNames lsShells); + shellNames = builtins.map (filename: builtins.head (builtins.split "\\." filename)) shellFiles; + systemAttrs = flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import (nixpkgsForSystem system) { inherit overlays system; }; + nameToValue = name: import (./shells + "/${name}.nix") { inherit pkgs inputs; }; + in { - devShells = - let - ls = builtins.readDir ./shells; - files = builtins.filter (name: ls.${name} == "regular") (builtins.attrNames ls); - shellNames = builtins.map (filename: builtins.head (builtins.split "\\." filename)) files; - nameToValue = name: import (./shells + "/${name}.nix") { inherit pkgs inputs; }; - in - builtins.listToAttrs (builtins.map (name: { inherit name; value = nameToValue name; }) shellNames); - }; - }; + devShells = builtins.listToAttrs (builtins.map (name: { inherit name; value = nameToValue name; }) shellNames); + } + ); + in + systemAttrs // { inherit nixosConfigurations; }; } diff --git a/modules/programs/default.nix b/modules/programs/default.nix index be723c11..6b01c6e4 100644 --- a/modules/programs/default.nix +++ b/modules/programs/default.nix @@ -20,7 +20,7 @@ rev = "b423b6a48e0b19260bc95ab7d72d2138d7f124dc"; hash = "sha256-09eELJXIekLGVHjDr9XXPYjsew+ZsSkcAmcMF27mcv8="; }; - patches = (old.patches or []) ++ [ + patches = (old.patches or [ ]) ++ [ (pkgs.fetchpatch { url = "https://patch-diff.githubusercontent.com/raw/yt-dlp/yt-dlp/pull/6654.diff"; hash = "sha256-TNOkhfCf02WZaHyTvlBKBfRre719mdScRJ0azyLTSyQ=";