From e1d7178979a421bbfc83961edb962871acf5c791 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Sun, 13 Jun 2021 12:15:09 -0500 Subject: [PATCH 01/22] init: common flake compat fixes for other nixpkgs fixes #315 --- overlays/various-flake-fixes.nix | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 overlays/various-flake-fixes.nix diff --git a/overlays/various-flake-fixes.nix b/overlays/various-flake-fixes.nix new file mode 100644 index 00000000..2bb1f70d --- /dev/null +++ b/overlays/various-flake-fixes.nix @@ -0,0 +1,9 @@ +final: prev: { + # Since: https://github.com/NixOS/nixpkgs/pull/126137 + nix-direnv = + if builtins.hasAttr "enableFlakes" prev.nix-direnv.override.__functionArgs + then prev.nix-direnv.override { + enableFlakes = true; + } + else prev.nix-direnv; +} From 62683b24acc01aad5785569f18219eca9764df90 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Sun, 13 Jun 2021 23:30:05 -0500 Subject: [PATCH 02/22] ref: pass our lib as lib.our to the module system At least we don't find ourselves with strange module signatures and use something that looks like a dedicated namespace within he module system: `config.lib` --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 359aa31a..e870ac13 100644 --- a/flake.nix +++ b/flake.nix @@ -71,7 +71,7 @@ channelName = "nixos"; modules = ./modules/module-list.nix; externalModules = [ - { _module.args.ourLib = self.lib; } + { lib.our = self.lib; } ci-agent.nixosModules.agent-profile home.nixosModules.home-manager agenix.nixosModules.age From 3cc28b3adb93f15ff8f23097c27e4b666ee6ba2b Mon Sep 17 00:00:00 2001 From: David Arnold Date: Sat, 19 Jun 2021 13:26:07 -0500 Subject: [PATCH 03/22] bump digga to latest develop --- flake.lock | 137 ++++++++++++++-------------------- flake.nix | 17 +++-- modules/customBuilds.nix | 49 ++++++------ modules/module-list.nix | 1 - users/modules/.flake-keep | 0 users/modules/module-list.nix | 1 - 6 files changed, 88 insertions(+), 117 deletions(-) delete mode 100644 modules/module-list.nix create mode 100644 users/modules/.flake-keep delete mode 100644 users/modules/module-list.nix diff --git a/flake.lock b/flake.lock index e0411771..7f67e263 100644 --- a/flake.lock +++ b/flake.lock @@ -72,15 +72,21 @@ "inputs": { "flake-compat": "flake-compat_2", "naersk": "naersk", - "nixpkgs": "nixpkgs", - "utils": "utils" + "nixpkgs": [ + "digga", + "nixpkgs" + ], + "utils": [ + "digga", + "utils" + ] }, "locked": { - "lastModified": 1616406726, - "narHash": "sha256-n9zmgxR03QNrvs9/fHewqE0j3SjL7Y+cglBCFu3U3rg=", + "lastModified": 1623011836, + "narHash": "sha256-02M4P3eqUdV+ouZb8n1KDR1CXeZQm17cKpjKZKi0c10=", "owner": "serokell", "repo": "deploy-rs", - "rev": "9e405fbc5ab5bacbd271fd78c6b6b6877c4d9f8d", + "rev": "70d71b3027b1793b780f1e2435bdbbe1b0cb9ac6", "type": "github" }, "original": { @@ -109,20 +115,21 @@ "deploy": "deploy", "devshell": "devshell", "nixlib": "nixlib", - "nixpkgs": "nixpkgs_2", - "utils": "utils_2" + "nixos-generators": "nixos-generators", + "nixpkgs": "nixpkgs", + "utils": "utils" }, "locked": { - "lastModified": 1623197477, - "narHash": "sha256-2Qk/uIHb1nXre2rRlGonAJmpuamBs7RRfgXhMmS5JkU=", + "lastModified": 1624576193, + "narHash": "sha256-EPemiDnTx0V622bMtGpcgclSExljWK3+qXZMiZVvvEc=", "owner": "divnix", "repo": "digga", - "rev": "f69703abc33f221b676966a8435c4f09ef70ff49", + "rev": "241896d3942fe3f818ce9a153955dbcadd9f00fc", "type": "github" }, "original": { "owner": "divnix", - "ref": "master", + "ref": "develop", "repo": "digga", "type": "github" } @@ -161,11 +168,11 @@ }, "flake-utils": { "locked": { - "lastModified": 1620759905, - "narHash": "sha256-WiyWawrgmyN0EdmiHyG2V+fqReiVi8bM9cRdMaKQOFg=", + "lastModified": 1623660459, + "narHash": "sha256-OTmOsh43po7r5F9s9H6lVCBQ2b0FikWbmiwLbMAGRdw=", "owner": "numtide", "repo": "flake-utils", - "rev": "b543720b25df6ffdfcf9227afafc5b8c1fabfae8", + "rev": "98c8d36b1828009b20f12544214683c7489935a1", "type": "github" }, "original": { @@ -211,15 +218,16 @@ "naersk": { "inputs": { "nixpkgs": [ - "latest" + "digga", + "nixpkgs" ] }, "locked": { - "lastModified": 1610392286, - "narHash": "sha256-3wFl5y+4YZO4SgRYK8WE7JIS3p0sxbgrGaQ6RMw+d98=", + "lastModified": 1622810282, + "narHash": "sha256-4wmvM3/xfD0hCdNDIXVzRMfL4yB1J+DjH6Zte2xbAxk=", "owner": "nmattia", "repo": "naersk", - "rev": "d7bfbad3304fd768c0f93a4c3b50976275e6d4be", + "rev": "e8061169e1495871b56be97c5c51d310fae01374", "type": "github" }, "original": { @@ -229,26 +237,6 @@ "type": "github" } }, - "naersk_2": { - "inputs": { - "nixpkgs": [ - "latest" - ] - }, - "locked": { - "lastModified": 1614785451, - "narHash": "sha256-TPw8kQvr2UNCuvndtY+EjyXp6Q5GEW2l9UafXXh1XmI=", - "owner": "nmattia", - "repo": "naersk", - "rev": "e0fe990b478a66178a58c69cf53daec0478ca6f9", - "type": "github" - }, - "original": { - "owner": "nmattia", - "repo": "naersk", - "type": "github" - } - }, "nixlib": { "locked": { "lastModified": 1620519687, @@ -266,19 +254,40 @@ }, "nixos": { "locked": { - "lastModified": 1615797423, - "narHash": "sha256-5NGDZXPQzuoxf/42NiyC9YwwhwzfMfIRrz3aT0XHzSc=", + "lastModified": 1624125633, + "narHash": "sha256-AAJPHLnK3Y/R8F7cL1cgTmC5GcfjqjhaV7D0PdyQk8A=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "266dc8c3d052f549826ba246d06787a219533b8f", + "rev": "59979f87460379fb2156e462a941b97ddf62ee3a", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "nixos-unstable", + "ref": "release-21.05", "type": "indirect" } }, + "nixos-generators": { + "inputs": { + "nixpkgs": [ + "digga", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1624117213, + "narHash": "sha256-hAoBANafVdM/+8Z6PrlPEKPN6LrdkM4qg2Q/ji0XUns=", + "owner": "nix-community", + "repo": "nixos-generators", + "rev": "c64d3c2153274a6ab355e57f5eedfe6f85073d24", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-generators", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1615652054, @@ -296,27 +305,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1610942247, - "narHash": "sha256-PKo1ATAlC6BmfYSRmX0TVmNoFbrec+A5OKcabGEu2yU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "7d71001b796340b219d1bfa8552c81995017544a", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1620962350, - "narHash": "sha256-9ASW4d4/Z8HmRvuJI8rxbEOTbXTBpQ8y+CmFYBwtXzE=", + "lastModified": 1624148921, + "narHash": "sha256-FAhKTXZV67C36hK5lPvZfsFt+QY1QSHYQXwGXqpOChs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5d4a430472cafada97888cc80672fab255231f57", + "rev": "f2122ea5815648effdd97157c7bf4e9a1a6dbb34", "type": "github" }, "original": { @@ -379,7 +372,6 @@ "digga": "digga", "home": "home", "latest": "latest", - "naersk": "naersk_2", "nixos": "nixos", "nixos-hardware": "nixos-hardware", "nur": "nur", @@ -387,30 +379,15 @@ } }, "utils": { - "locked": { - "lastModified": 1610051610, - "narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "utils_2": { "inputs": { "flake-utils": "flake-utils" }, "locked": { - "lastModified": 1622583383, - "narHash": "sha256-2DFx619SNfjzYwqx1ryae8zHnTh+N7VsZkbtAbrYIIA=", + "lastModified": 1624128793, + "narHash": "sha256-yZYvpT6i6iRK0x1a8k/LCoS7JGLVk6Yi1eqfhatnDLk=", "owner": "gytis-ivaskevicius", "repo": "flake-utils-plus", - "rev": "6b2ea4b02cad77fac581c6a9ec4f822ba87dce5c", + "rev": "785e6f13b8c6131d1eee625a713e8475b2b0512b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index e870ac13..5fef5eec 100644 --- a/flake.nix +++ b/flake.nix @@ -3,9 +3,12 @@ inputs = { - nixos.url = "nixpkgs/nixos-unstable"; + nixos.url = "nixpkgs/release-21.05"; latest.url = "nixpkgs"; - digga.url = "github:divnix/digga/master"; + digga = { + url = "github:divnix/digga/develop"; + inputs.nipxkgs.follows = "latest"; + }; ci-agent = { url = "github:hercules-ci/hercules-ci-agent"; @@ -15,8 +18,8 @@ darwin.inputs.nixpkgs.follows = "latest"; home.url = "github:nix-community/home-manager"; home.inputs.nixpkgs.follows = "nixos"; - naersk.url = "github:nmattia/naersk"; - naersk.inputs.nixpkgs.follows = "latest"; + # naersk.url = "github:nmattia/naersk"; + # naersk.inputs.nixpkgs.follows = "latest"; agenix.url = "github:ryantm/agenix"; agenix.inputs.nixpkgs.follows = "latest"; nixos-hardware.url = "github:nixos/nixos-hardware"; @@ -59,6 +62,7 @@ sharedOverlays = [ (final: prev: { + __dontExport = true; lib = prev.lib.extend (lfinal: lprev: { our = self.lib; }); @@ -69,13 +73,12 @@ hostDefaults = { system = "x86_64-linux"; channelName = "nixos"; - modules = ./modules/module-list.nix; + imports = [ (digga.lib.importers.modules ./modules) ]; externalModules = [ { lib.our = self.lib; } ci-agent.nixosModules.agent-profile home.nixosModules.home-manager agenix.nixosModules.age - ./modules/customBuilds.nix ]; }; @@ -95,7 +98,7 @@ }; home = { - modules = ./users/modules/module-list.nix; + imports = [ (digga.lib.importers.modules ./users/modules) ]; externalModules = [ ]; importables = rec { profiles = digga.lib.importers.rakeLeaves ./users/profiles; diff --git a/modules/customBuilds.nix b/modules/customBuilds.nix index 7181f65e..cbaefe3c 100644 --- a/modules/customBuilds.nix +++ b/modules/customBuilds.nix @@ -1,33 +1,26 @@ -{ lib, self, diggaLib, config, modules, channel, ... }: -let - mkBuild = buildModule: - # TODO: get specialArgs as a module argument and drop builderArgs usage - channel.input.lib.nixosSystem (diggaLib.mergeAny config.lib.builderArgs { - modules = [ buildModule ]; - }); -in +{ lib, pkgs, self, config, modules, channel, ... }: { system.build = { - iso = (mkBuild (diggaLib.modules.isoConfig { - inherit self; - fullHostConfig = config; - })).config.system.build.isoImage; + iso = (config.lib.digga.mkBuild + (config.lib.digga.modules.isoConfig { + inherit self; + fullHostConfig = config; + }) + ).config.system.build.isoImage; - homes = (mkBuild ({ config, ... }: { - home-manager.useUserPackages = lib.mkForce false; - home-manager.sharedModules = [ - { - home.sessionVariables = { - inherit (config.environment.sessionVariables) NIX_PATH; - }; - xdg.configFile."nix/registry.json".text = - config.environment.etc."nix/registry.json".text; - } - ]; - })).config.home-manager.users; - - digitalOcean = (mkBuild ({ modulesPath, ... }: { - imports = [ "${modulesPath}/virtualisation/digital-ocean-image.nix" ]; - })).config.system.build.digitalOceanImage; + homes = (config.lib.digga.mkBuild + ({ config, ... }: { + home-manager.useUserPackages = lib.mkForce false; + home-manager.sharedModules = [ + { + home.sessionVariables = { + inherit (config.environment.sessionVariables) NIX_PATH; + }; + xdg.configFile."nix/registry.json".text = + config.environment.etc."nix/registry.json".text; + } + ]; + }) + ).config.home-manager.users; }; } diff --git a/modules/module-list.nix b/modules/module-list.nix deleted file mode 100644 index 1e3ec721..00000000 --- a/modules/module-list.nix +++ /dev/null @@ -1 +0,0 @@ -[ ] diff --git a/users/modules/.flake-keep b/users/modules/.flake-keep new file mode 100644 index 00000000..e69de29b diff --git a/users/modules/module-list.nix b/users/modules/module-list.nix deleted file mode 100644 index 1e3ec721..00000000 --- a/users/modules/module-list.nix +++ /dev/null @@ -1 +0,0 @@ -[ ] From 1c80b508ca29def7c0df7f1e883fd9ca86d125f5 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Thu, 24 Jun 2021 18:15:15 -0500 Subject: [PATCH 04/22] bump: nixpkgs to avoid https://github.com/NixOS/nixpkgs/pull/127720 --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 7f67e263..535d572c 100644 --- a/flake.lock +++ b/flake.lock @@ -254,11 +254,11 @@ }, "nixos": { "locked": { - "lastModified": 1624125633, - "narHash": "sha256-AAJPHLnK3Y/R8F7cL1cgTmC5GcfjqjhaV7D0PdyQk8A=", + "lastModified": 1624575719, + "narHash": "sha256-MVQJ2ltjqrxdB8zHj2s05ujgX6VbCDZ/+K8j2xh59Hk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "59979f87460379fb2156e462a941b97ddf62ee3a", + "rev": "001f78ff0044adf3ca972643eaf3fc5cbc8f634c", "type": "github" }, "original": { From ee89bf3f2a166c610101f93f1b3053068f86626f Mon Sep 17 00:00:00 2001 From: GTrunSec Date: Sun, 13 Jun 2021 21:48:43 -0700 Subject: [PATCH 05/22] feature: Add pkgs fetch manager nvfetcher Co-authored-by: David Arnold --- .gitignore | 2 ++ README.md | 34 +++++++++++++----------- flake.lock | 53 +++++++++++++++++++++++++++++++------ flake.nix | 20 +++++++++----- overlays/manix.nix | 5 ++++ overlays/overrides.nix | 1 - pkgs/_sources/generated.nix | 17 ++++++++++++ pkgs/default.nix | 6 ++++- pkgs/flake.lock | 25 ----------------- pkgs/flake.nix | 52 ------------------------------------ pkgs/sources.toml | 4 +++ 11 files changed, 110 insertions(+), 109 deletions(-) create mode 100644 overlays/manix.nix create mode 100644 pkgs/_sources/generated.nix delete mode 100644 pkgs/flake.lock delete mode 100644 pkgs/flake.nix create mode 100644 pkgs/sources.toml diff --git a/.gitignore b/.gitignore index e2486b12..1721f0d9 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ doc/index.html vm iso doi + +pkgs/_sources/.shake* diff --git a/README.md b/README.md index f347f4a2..78c30ea4 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ following giants][giants]: ### :family: — like family - [`numtide/devshell`][devshell] - [`serokell/deploy-rs`][deploy] +- [`berberman/nvfetcher`][nvfetcher] - [`NixOS/nixpkgs`][nixpkgs] :heart: @@ -94,22 +95,23 @@ goals are sufficiently upstreamed into "the Nix", dissolved. # License DevOS is licensed under the [MIT License][mit]. -[mk-flake]: https://github.com/divnix/digga/tree/master/src/mkFlake -[nixpkgs]: https://github.com/NixOS/nixpkgs -[deploy]: https://github.com/serokell/deploy-rs -[toc]: https://github.com/divnix/devos/blob/core/flake.nix -[giants]: https://en.wikipedia.org/wiki/Standing_on_the_shoulders_of_giants -[digga]: https://github.com/divnix/digga -[fup]: https://github.com/gytis-ivaskevicius/flake-utils-plus -[fu]: https://github.com/numtide/flake-utils -[devshell]: https://github.com/numtide/devshell -[nix]: https://nixos.org/manual/nix/stable -[mit]: https://mit-license.org -[nixos]: https://nixos.org/manual/nixos/stable -[home-manager]: https://nix-community.github.io/home-manager -[flakes]: https://nixos.wiki/wiki/Flakes -[flake-doc]: https://github.com/NixOS/nix/blob/master/src/nix/flake.md -[core]: https://github.com/divnix/devos [community]: https://github.com/divnix/devos/tree/community +[core]: https://github.com/divnix/devos +[deploy]: https://github.com/serokell/deploy-rs +[devshell]: https://github.com/numtide/devshell +[digga]: https://github.com/divnix/digga [dotfiles]: https://github.com/hlissner/dotfiles +[flake-doc]: https://github.com/NixOS/nix/blob/master/src/nix/flake.md +[flakes]: https://nixos.wiki/wiki/Flakes +[fu]: https://github.com/numtide/flake-utils +[fup]: https://github.com/gytis-ivaskevicius/flake-utils-plus +[giants]: https://en.wikipedia.org/wiki/Standing_on_the_shoulders_of_giants +[home-manager]: https://nix-community.github.io/home-manager +[mit]: https://mit-license.org +[mk-flake]: https://github.com/divnix/digga/tree/master/src/mkFlake +[nix]: https://nixos.org/manual/nix/stable +[nixos]: https://nixos.org/manual/nixos/stable +[nixpkgs]: https://github.com/NixOS/nixpkgs +[nvfetcher]: https://github.com/berberman/nvfetcher [please]: https://github.com/nrdxp/devos/tree/nrd +[toc]: https://github.com/divnix/devos/blob/core/flake.nix diff --git a/flake.lock b/flake.lock index 535d572c..5a2bf6b7 100644 --- a/flake.lock +++ b/flake.lock @@ -166,6 +166,22 @@ "type": "github" } }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1606424373, + "narHash": "sha256-oq8d4//CJOrVj+EcOaSXvMebvuTkmBJuT5tzlfewUnQ=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "99f1c2157fba4bfe6211a321fd0ee43199025dbf", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1623660459, @@ -181,6 +197,21 @@ "type": "github" } }, + "flake-utils_2": { + "locked": { + "lastModified": 1620759905, + "narHash": "sha256-WiyWawrgmyN0EdmiHyG2V+fqReiVi8bM9cRdMaKQOFg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b543720b25df6ffdfcf9227afafc5b8c1fabfae8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home": { "inputs": { "nixpkgs": [ @@ -332,20 +363,26 @@ "type": "indirect" } }, - "pkgs": { + "nvfetcher": { "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_2", "nixpkgs": [ - "nixos" + "latest" ] }, "locked": { - "narHash": "sha256-Zs7dc0dNNa0Z3//+Gckxj7SKrMqVovY0xZZ1z8xWnEg=", - "path": "./pkgs", - "type": "path" + "lastModified": 1624534673, + "narHash": "sha256-7HWt8Xh4aIFfGKAFQus5euhYxcWLe6kXz1DsGuV0WbU=", + "owner": "berberman", + "repo": "nvfetcher", + "rev": "a8514f53c7999d23b48d2f42de63660bc3d7850f", + "type": "github" }, "original": { - "path": "./pkgs", - "type": "path" + "owner": "berberman", + "repo": "nvfetcher", + "type": "github" } }, "pre-commit-hooks-nix": { @@ -375,7 +412,7 @@ "nixos": "nixos", "nixos-hardware": "nixos-hardware", "nur": "nur", - "pkgs": "pkgs" + "nvfetcher": "nvfetcher" } }, "utils": { diff --git a/flake.nix b/flake.nix index 5fef5eec..95859a80 100644 --- a/flake.nix +++ b/flake.nix @@ -24,13 +24,12 @@ agenix.inputs.nixpkgs.follows = "latest"; nixos-hardware.url = "github:nixos/nixos-hardware"; - pkgs.url = "path:./pkgs"; - pkgs.inputs.nixpkgs.follows = "nixos"; + nvfetcher.url = "github:berberman/nvfetcher"; + nvfetcher.inputs.nixpkgs.follows = "latest"; }; outputs = { self - , pkgs , digga , nixos , ci-agent @@ -38,6 +37,7 @@ , nixos-hardware , nur , agenix + , nvfetcher , ... } @ inputs: digga.lib.mkFlake { @@ -49,10 +49,11 @@ nixos = { imports = [ (digga.lib.importers.overlays ./overlays) ]; overlays = [ - ./pkgs/default.nix - pkgs.overlay # for `srcs` nur.overlay agenix.overlay + nvfetcher.overlay + (final: prev: { nvfetcher-bin = nvfetcher.defaultPackage.${final.system}; }) + ./pkgs/default.nix ]; }; latest = { }; @@ -109,7 +110,14 @@ }; devshell.externalModules = { pkgs, ... }: { - packages = [ pkgs.agenix ]; + commands = [ + { package = pkgs.agenix; category = "secrets"; } + { + name = pkgs.nvfetcher-bin.pname; + help = pkgs.nvfetcher-bin.meta.description; + command = "cd $DEVSHELL_ROOT/pkgs; ${pkgs.nvfetcher-bin}/bin/nvfetcher -c ./sources.toml --no-output $@; nixpkgs-fmt _sources/"; + } + ]; }; homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; diff --git a/overlays/manix.nix b/overlays/manix.nix new file mode 100644 index 00000000..d39baa74 --- /dev/null +++ b/overlays/manix.nix @@ -0,0 +1,5 @@ +final: prev: { + manix = prev.manix.overrideAttrs (o: rec{ + inherit (prev.sources.manix) pname version src; + }); +} diff --git a/overlays/overrides.nix b/overlays/overrides.nix index 629f44b1..da1f0ee0 100644 --- a/overlays/overrides.nix +++ b/overlays/overrides.nix @@ -7,7 +7,6 @@ channels: final: prev: { dhall discord element-desktop - manix rage nixpkgs-fmt qutebrowser diff --git a/pkgs/_sources/generated.nix b/pkgs/_sources/generated.nix new file mode 100644 index 00000000..0d13ac01 --- /dev/null +++ b/pkgs/_sources/generated.nix @@ -0,0 +1,17 @@ +# This file was generated by nvfetcher, please do not modify it manually. +{ fetchgit, fetchurl }: +{ + manix = { + pname = "manix"; + version = "d08e7ca185445b929f097f8bfb1243a8ef3e10e4"; + src = fetchgit { + url = "https://github.com/mlvzk/manix"; + rev = "d08e7ca185445b929f097f8bfb1243a8ef3e10e4"; + fetchSubmodules = false; + deepClone = false; + leaveDotGit = false; + sha256 = "1b7xi8c2drbwzfz70czddc4j33s7g1alirv12dwl91hbqxifx8qs"; + }; + + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index ce168707..924a2300 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1 +1,5 @@ -final: prev: { } +final: prev: { + # keep sources this first + sources = prev.callPackage (import ./_sources/generated.nix) { }; + # then, call packages with `final.callPackage` +} diff --git a/pkgs/flake.lock b/pkgs/flake.lock deleted file mode 100644 index ef3f5a9a..00000000 --- a/pkgs/flake.lock +++ /dev/null @@ -1,25 +0,0 @@ -{ - "nodes": { - "nixpkgs": { - "locked": { - "lastModified": 1615926763, - "narHash": "sha256-yeq8A3EPNuQVlsxlEQrIRsklfJwJK0Us6jtcG/u8wNs=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "b702a56d417647de4090ac56c0f18bdc7e646610", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "root": { - "inputs": { - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/pkgs/flake.nix b/pkgs/flake.nix deleted file mode 100644 index 1b6cc0a2..00000000 --- a/pkgs/flake.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ - description = "Package Sources"; - - inputs = { }; - - outputs = { self, nixpkgs, ... }: { - overlay = final: prev: { - inherit (self) srcs; - }; - - srcs = - let - inherit (nixpkgs) lib; - - mkVersion = name: input: - let - inputs = (builtins.fromJSON - (builtins.readFile ./flake.lock)).nodes; - - ref = - if lib.hasAttrByPath [ name "original" "ref" ] inputs - then inputs.${name}.original.ref - else ""; - - version = - let version' = builtins.match - "[[:alpha:]]*[-._]?([0-9]+(\.[0-9]+)*)+" - ref; - in - if lib.isList version' - then lib.head version' - else if input ? lastModifiedDate && input ? shortRev - then "${lib.substring 0 8 input.lastModifiedDate}_${input.shortRev}" - else null; - in - version; - in - lib.mapAttrs - (pname: input: - let - version = mkVersion pname input; - in - input // { inherit pname; } - // lib.optionalAttrs (! isNull version) - { - inherit version; - } - ) - (lib.filterAttrs (n: _: n != "nixpkgs") - self.inputs); - }; -} diff --git a/pkgs/sources.toml b/pkgs/sources.toml new file mode 100644 index 00000000..f7af168e --- /dev/null +++ b/pkgs/sources.toml @@ -0,0 +1,4 @@ +# nvfetcher.toml +[manix] +src.git = "https://github.com/mlvzk/manix" +fetch.github = "mlvzk/manix" From b927d97ce2fe99977b10a792a094952a514dcfe5 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Wed, 16 Jun 2021 17:25:37 -0500 Subject: [PATCH 06/22] doc: nvfetcher --- doc/SUMMARY.md | 1 + doc/integrations/nvfetcher.md | 43 +++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 doc/integrations/nvfetcher.md diff --git a/doc/SUMMARY.md b/doc/SUMMARY.md index e2b6e9a4..4378683f 100644 --- a/doc/SUMMARY.md +++ b/doc/SUMMARY.md @@ -31,5 +31,6 @@ - [Integrations](./integrations/index.md) - [Cachix](./integrations/cachix.md) - [Deploy RS](./integrations/deploy.md) + - [NvFetcher](./integrations/nvfetcher.md) - [Hercules CI](./integrations/hercules.md) - [Contributing](./CONTRIBUTING.md) diff --git a/doc/integrations/nvfetcher.md b/doc/integrations/nvfetcher.md new file mode 100644 index 00000000..2bfaa029 --- /dev/null +++ b/doc/integrations/nvfetcher.md @@ -0,0 +1,43 @@ +# nvfetcher +[NvFetcher][nvf] is a workflow companion for updating nix sources. + +You can specify an origin source and an update configuration, and +nvfetcher can for example track updates to a specific branch and +automatically update your nix sources configuration on each run +to the tip of that branch. + +All package source declaration is done in [sources.toml][sources.toml]. + +From within the devshell of this repo, run `nvfetcher`, a wrapped +version of `nvfetcher` that knows where to find and place its files +and commit the results. + +## Usage + +Statically fetching (not tracking) a particular tag from a github repo: +```toml +[manix] +src.manual = "v0.6.3" +fetch.github = "mlvzk/manix" +``` + +Tracking the latest github _release_ from a github repo: +```toml +[manix] +src.github = "mlvzk/manix" # responsible for tracking +fetch.github = "mlvzk/manix" # responsible for fetching +``` + +Tracking the latest commit of a git repository and fetch from a git repo: +```toml +[manix] +src.git = "https://github.com/mlvzk/manix.git" # responsible for tracking +fetch.git = "https://github.com/mlvzk/manix.git" # responsible for fetching +``` + +> ##### _Note:_ +> Please refer to the [NvFetcher Readme][nvf-readme] for more options. + +[nvf: https://github.com/berberman/nvfetcher +[nvf-readme]: https://github.com/berberman/nvfetcher#readme +[sources.toml]: https://github.com/divnix/devos/tree/core/pkgs/sources.toml From f1117f27ec333cc801fd04c70b7ba205330b986d Mon Sep 17 00:00:00 2001 From: GTrunSec Date: Thu, 24 Jun 2021 22:58:26 -0700 Subject: [PATCH 07/22] fix hasekllPackages overlay --- flake.nix | 1 - overlays/overrides.nix | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/flake.nix b/flake.nix index 95859a80..fd21f713 100644 --- a/flake.nix +++ b/flake.nix @@ -52,7 +52,6 @@ nur.overlay agenix.overlay nvfetcher.overlay - (final: prev: { nvfetcher-bin = nvfetcher.defaultPackage.${final.system}; }) ./pkgs/default.nix ]; }; diff --git a/overlays/overrides.nix b/overlays/overrides.nix index da1f0ee0..6280513d 100644 --- a/overlays/overrides.nix +++ b/overlays/overrides.nix @@ -14,15 +14,15 @@ channels: final: prev: { starship; - haskellPackages = prev.haskellPackages.override { - overrides = hfinal: hprev: - let version = prev.lib.replaceChars [ "." ] [ "" ] prev.ghc.version; - in - { - # same for haskell packages, matching ghc versions - inherit (channels.latest.haskell.packages."ghc${version}") - haskell-language-server; - }; - }; - + haskellPackages = prev.haskellPackages.override + (old: { + overrides = prev.lib.composeExtensions (old.overrides or (_: _: { })) (hfinal: hprev: + let version = prev.lib.replaceChars [ "." ] [ "" ] prev.ghc.version; + in + { + # same for haskell packages, matching ghc versions + inherit (channels.latest.haskell.packages."ghc${version}") + haskell-language-server; + }); + }); } From 95f429a5258b9b9d2f9be243c97f83da5385b06b Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Wed, 30 Jun 2021 08:50:07 -0600 Subject: [PATCH 08/22] core: use bottom instead of gotop --- profiles/core/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/profiles/core/default.nix b/profiles/core/default.nix index 9e98ba6b..d2801d89 100644 --- a/profiles/core/default.nix +++ b/profiles/core/default.nix @@ -17,7 +17,7 @@ in dosfstools fd git - gotop + bottom gptfdisk iputils jq @@ -84,7 +84,7 @@ in se = ifSudo "sudoedit"; # top - top = "gotop"; + top = "btm"; # systemd ctl = "systemctl"; From 33fb25e011b050bf577a0fd77f29348e0126abc0 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Wed, 7 Jul 2021 19:31:12 -0500 Subject: [PATCH 09/22] ref: move devshell module here to `devos` again --- .gitignore | 2 - flake.lock | 157 ++++++++++++++++++++++++++------------ flake.nix | 32 ++++---- pkgs/bud/default.nix | 10 +++ pkgs/bud/get.bash | 6 ++ shell/default.nix | 62 +++++++++++++++ shell/hooks/default.nix | 4 + shell/hooks/pre-commit.sh | 29 +++++++ 8 files changed, 240 insertions(+), 62 deletions(-) create mode 100644 pkgs/bud/default.nix create mode 100644 pkgs/bud/get.bash create mode 100644 shell/default.nix create mode 100644 shell/hooks/default.nix create mode 100755 shell/hooks/pre-commit.sh diff --git a/.gitignore b/.gitignore index 1721f0d9..4a991230 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ result -up -hosts/up-* .direnv doc/index.html diff --git a/flake.lock b/flake.lock index 5a2bf6b7..8344bfbe 100644 --- a/flake.lock +++ b/flake.lock @@ -20,6 +20,25 @@ "type": "github" } }, + "bud": { + "inputs": { + "devshell": "devshell", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1625703505, + "narHash": "sha256-PNtHOR5wp3R/cysCHTIFcxCHHuisljbrS6iNyP/Ivfk=", + "owner": "divnix", + "repo": "bud", + "rev": "baefc56e5819375736b51e93df9e2154a120ea3d", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "bud", + "type": "github" + } + }, "ci-agent": { "inputs": { "flake-compat": "flake-compat", @@ -35,11 +54,11 @@ "pre-commit-hooks-nix": "pre-commit-hooks-nix" }, "locked": { - "lastModified": 1619088868, - "narHash": "sha256-l9db+HpNIkY41MonGE8z4pbkjBa5BdzJTG5AxV7V7Lw=", + "lastModified": 1624885917, + "narHash": "sha256-CaAEhMKzuTyN9krTLZ1jWW3C5HzvKRZY/doVOezZZx0=", "owner": "hercules-ci", "repo": "hercules-ci-agent", - "rev": "08f953a263518a3af0ca28cd887020ff3465bdf5", + "rev": "5eba6597af97e358542c6f968f6ef680ffd2a401", "type": "github" }, "original": { @@ -55,11 +74,11 @@ ] }, "locked": { - "lastModified": 1613595894, - "narHash": "sha256-MOk/7rCAUB5Lf4GL+HimvyAAZXYEw8gWsq5nW4PPQQA=", + "lastModified": 1622060422, + "narHash": "sha256-hPVlvrAyf6zL7tTx0lpK+tMxEfZeMiIZ/A2xaJ41WOY=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "5c3146b75d5d478f0693d0ea6c83f1da8382ff56", + "rev": "007d700e644ac588ad6668e6439950a5b6e2ff64", "type": "github" }, "original": { @@ -73,20 +92,16 @@ "flake-compat": "flake-compat_2", "naersk": "naersk", "nixpkgs": [ - "digga", - "nixpkgs" + "nixos" ], - "utils": [ - "digga", - "utils" - ] + "utils": "utils" }, "locked": { - "lastModified": 1623011836, - "narHash": "sha256-02M4P3eqUdV+ouZb8n1KDR1CXeZQm17cKpjKZKi0c10=", + "lastModified": 1625248509, + "narHash": "sha256-G721I9brAMCkZKXIFsgOQ1JCZ9Rj9DM7QSm0pvpQldc=", "owner": "serokell", "repo": "deploy-rs", - "rev": "70d71b3027b1793b780f1e2435bdbbe1b0cb9ac6", + "rev": "364ef202e400e4c941e18833ca38fa848ac5a148", "type": "github" }, "original": { @@ -97,11 +112,26 @@ }, "devshell": { "locked": { - "lastModified": 1622013274, - "narHash": "sha256-mK/Lv0lCbl07dI5s7tR/7nb79HunKnJik3KyR6yeI2k=", + "lastModified": 1625086391, + "narHash": "sha256-IpNPv1v8s4L3CoxhwcgZIitGpcrnNgnj09X7TA0QV3k=", "owner": "numtide", "repo": "devshell", - "rev": "e7faf69e6bf8546517cc936c7f6d31c7eb3abcb2", + "rev": "4b5ac7cf7d9a1cc60b965bb51b59922f2210cbc7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "devshell_2": { + "locked": { + "lastModified": 1625086391, + "narHash": "sha256-IpNPv1v8s4L3CoxhwcgZIitGpcrnNgnj09X7TA0QV3k=", + "owner": "numtide", + "repo": "devshell", + "rev": "4b5ac7cf7d9a1cc60b965bb51b59922f2210cbc7", "type": "github" }, "original": { @@ -112,19 +142,21 @@ }, "digga": { "inputs": { - "deploy": "deploy", - "devshell": "devshell", + "deploy": [ + "deploy" + ], + "devshell": "devshell_2", "nixlib": "nixlib", "nixos-generators": "nixos-generators", - "nixpkgs": "nixpkgs", - "utils": "utils" + "nixpkgs": "nixpkgs_2", + "utils": "utils_2" }, "locked": { - "lastModified": 1624576193, - "narHash": "sha256-EPemiDnTx0V622bMtGpcgclSExljWK3+qXZMiZVvvEc=", + "lastModified": 1625701039, + "narHash": "sha256-4IqBKop1XmS2z7Y5nsf8Af4wSCYJfy4kXUt/zgPwhSU=", "owner": "divnix", "repo": "digga", - "rev": "241896d3942fe3f818ce9a153955dbcadd9f00fc", + "rev": "05ee310fdfa81b1a8ecc7a8075d62ed702d72430", "type": "github" }, "original": { @@ -219,11 +251,11 @@ ] }, "locked": { - "lastModified": 1616724076, - "narHash": "sha256-SwbPXLjN2sLy4NL/GhodiJrdkIVZwGGTGiCN3JxH1cU=", + "lastModified": 1625694413, + "narHash": "sha256-goRLk1I/OMclS9i17g932wyHyjiKI+htbuFIWIkzTbw=", "owner": "nix-community", "repo": "home-manager", - "rev": "fedfd430f96695997b3eaf8d7e82ca79406afa23", + "rev": "06ee8ec8dfc4554c374052cd7b7083765748af99", "type": "github" }, "original": { @@ -234,11 +266,11 @@ }, "latest": { "locked": { - "lastModified": 1619400530, - "narHash": "sha256-7ZO7B+b9i1wFbHw62EFT+iwuBBpXeA/fcHlR63Z4J0w=", + "lastModified": 1625702968, + "narHash": "sha256-MadGtaIuPvTh9JLZULkQerZae8TFBczg8c12AijZc+s=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e8dc8adab655eb27957859c62bef11484b53f639", + "rev": "46c8ac79dbc9a4bcb7db4592d4708fb009284e13", "type": "github" }, "original": { @@ -249,7 +281,7 @@ "naersk": { "inputs": { "nixpkgs": [ - "digga", + "deploy", "nixpkgs" ] }, @@ -285,11 +317,11 @@ }, "nixos": { "locked": { - "lastModified": 1624575719, - "narHash": "sha256-MVQJ2ltjqrxdB8zHj2s05ujgX6VbCDZ/+K8j2xh59Hk=", + "lastModified": 1625702791, + "narHash": "sha256-3aiSEfGaBwi1mumzfSgwiO3kxGD+IHe9HAv3S227KI8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "001f78ff0044adf3ca972643eaf3fc5cbc8f634c", + "rev": "977b522d3101ad847fd51d695b817fe2cf8efaf6", "type": "github" }, "original": { @@ -321,11 +353,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1615652054, - "narHash": "sha256-jqXKU8Ovpi7MmPRqGf2FB3QOPcZtGwO2MFc0AYiOPjg=", + "lastModified": 1625333638, + "narHash": "sha256-M6J9RN60XJyv6nUfDFCwnz5aVjhe8+GJnV8Q9VpdQQQ=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "31f61b90ddb9257b94888ee17ccf96236e180c76", + "rev": "41775780a0b6b32b3d32dcc32bb9bc6df809062d", "type": "github" }, "original": { @@ -335,6 +367,20 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1624831744, + "narHash": "sha256-gGSxxnWnXRALLKfStsG3C4X+XUzAkHlKx02xHzkGZio=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "dbf5cd2d90cbf8b281c1938632b431d1e61d3249", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1624148921, "narHash": "sha256-FAhKTXZV67C36hK5lPvZfsFt+QY1QSHYQXwGXqpOChs=", @@ -351,11 +397,11 @@ }, "nur": { "locked": { - "lastModified": 1615921934, - "narHash": "sha256-nURGM869KKA1+c1SHHsXKYcPXhHIuxWBjNXjJ90OzRQ=", + "lastModified": 1625695235, + "narHash": "sha256-xJ8jHWkX7IyAImQ8MpWTbUonski38R4bWDNs8pJJzpk=", "owner": "nix-community", "repo": "NUR", - "rev": "faf862e8cf009edfa38ecc61188f7a6ace293552", + "rev": "9e2254aee0cce4b05f27447e51c001ab66aed7e0", "type": "github" }, "original": { @@ -372,11 +418,11 @@ ] }, "locked": { - "lastModified": 1624534673, - "narHash": "sha256-7HWt8Xh4aIFfGKAFQus5euhYxcWLe6kXz1DsGuV0WbU=", + "lastModified": 1624890984, + "narHash": "sha256-RMQtTm4OoEc8BHWk4/Yfu1y4uHlG4HCP+DeC0J0zGqQ=", "owner": "berberman", "repo": "nvfetcher", - "rev": "a8514f53c7999d23b48d2f42de63660bc3d7850f", + "rev": "d3efa8c58057dbcc1565dca3105d31d9f25fd5ca", "type": "github" }, "original": { @@ -388,11 +434,11 @@ "pre-commit-hooks-nix": { "flake": false, "locked": { - "lastModified": 1617783930, - "narHash": "sha256-SigoU2LWM1fMggqfM9H8XEIvjOjBVQ/wj/zrn02J28c=", + "lastModified": 1622650193, + "narHash": "sha256-qSzUpJDv04ajS9FXoCq6NjVF3qOt9IiGIiGh0P8amyw=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "2d169bb1b23f3b71a894a66ea81f45c788943248", + "rev": "0398f0649e0a741660ac5e8216760bae5cc78579", "type": "github" }, "original": { @@ -404,8 +450,10 @@ "root": { "inputs": { "agenix": "agenix", + "bud": "bud", "ci-agent": "ci-agent", "darwin": "darwin", + "deploy": "deploy", "digga": "digga", "home": "home", "latest": "latest", @@ -416,6 +464,21 @@ } }, "utils": { + "locked": { + "lastModified": 1622445595, + "narHash": "sha256-m+JRe6Wc5OZ/mKw2bB3+Tl0ZbtyxxxfnAWln8Q5qs+Y=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "7d706970d94bc5559077eb1a6600afddcd25a7c8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "utils_2": { "inputs": { "flake-utils": "flake-utils" }, diff --git a/flake.nix b/flake.nix index fd21f713..d409047c 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,11 @@ digga = { url = "github:divnix/digga/develop"; inputs.nipxkgs.follows = "latest"; + inputs.deploy.follows = "deploy"; }; + bud.url = "github:divnix/bud"; # no need to follow nixpkgs: it never materialises + deploy.url = "github:serokell/deploy-rs"; + deploy.inputs.nixpkgs.follows = "nixos"; ci-agent = { url = "github:hercules-ci/hercules-ci-agent"; @@ -31,6 +35,7 @@ outputs = { self , digga + , bud , nixos , ci-agent , home @@ -38,8 +43,12 @@ , nur , agenix , nvfetcher + , deploy , ... } @ inputs: + let + bud' = bud self; # rebind to access self.budModules + in digga.lib.mkFlake { inherit self inputs; @@ -52,6 +61,7 @@ nur.overlay agenix.overlay nvfetcher.overlay + deploy.overlay ./pkgs/default.nix ]; }; @@ -79,6 +89,7 @@ ci-agent.nixosModules.agent-profile home.nixosModules.home-manager agenix.nixosModules.age + (bud.nixosModules.bud bud') ]; }; @@ -108,25 +119,20 @@ }; }; - devshell.externalModules = { pkgs, ... }: { - commands = [ - { package = pkgs.agenix; category = "secrets"; } - { - name = pkgs.nvfetcher-bin.pname; - help = pkgs.nvfetcher-bin.meta.description; - command = "cd $DEVSHELL_ROOT/pkgs; ${pkgs.nvfetcher-bin}/bin/nvfetcher -c ./sources.toml --no-output $@; nixpkgs-fmt _sources/"; - } - ]; - }; + devshell.modules = [ (import ./shell bud') ]; homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { }; - defaultTemplate = self.templates.flk; - templates.flk.path = ./.; - templates.flk.description = "flk template"; + defaultTemplate = self.templates.bud; + templates.bud.path = ./.; + templates.bud.description = "bud template"; } + // + { + budModules = { devos = import ./pkgs/bud; }; + } ; } diff --git a/pkgs/bud/default.nix b/pkgs/bud/default.nix new file mode 100644 index 00000000..f96e1737 --- /dev/null +++ b/pkgs/bud/default.nix @@ -0,0 +1,10 @@ +{ pkgs, lib, budUtils, ... }: { + bud.cmds = with pkgs; { + get = { + writer = budUtils.writeBashWithPaths [ nixUnstable git coreutils ]; + synopsis = "get (core|community) [DEST]"; + help = "Copy the desired template to DEST"; + script = ./get.bash; + }; + }; +} diff --git a/pkgs/bud/get.bash b/pkgs/bud/get.bash new file mode 100644 index 00000000..15c834a2 --- /dev/null +++ b/pkgs/bud/get.bash @@ -0,0 +1,6 @@ +if [[ "$1" == "core" || "$1" == "community" ]]; then + nix flake new -t "github:divnix/devos/$1" "${2:-devos}" +else + echo "bud get (core|community) [DEST]" + exit 1 +fi diff --git a/shell/default.nix b/shell/default.nix new file mode 100644 index 00000000..8b67e1dc --- /dev/null +++ b/shell/default.nix @@ -0,0 +1,62 @@ +bud: +{ pkgs, extraModulesPath, ... }: +let + + hooks = import ./hooks; + + pkgWithCategory = category: package: { inherit package category; }; + linter = pkgWithCategory "linter"; + docs = pkgWithCategory "docs"; + devos = pkgWithCategory "devos"; + +in { + _file = toString ./.; + + imports = [ "${extraModulesPath}/git/hooks.nix" ]; + git = { inherit hooks; }; + + # tempfix: remove when merged https://github.com/numtide/devshell/pull/123 + devshell.startup.load_profiles = pkgs.lib.mkForce (pkgs.lib.noDepEntry '' + # PATH is devshell's exorbitant privilige: + # fence against its pollution + _PATH=''${PATH} + # Load installed profiles + for file in "$DEVSHELL_DIR/etc/profile.d/"*.sh; do + # If that folder doesn't exist, bash loves to return the whole glob + [[ -f "$file" ]] && source "$file" + done + # Exert exorbitant privilige and leave no trace + export PATH=''${_PATH} + unset _PATH + ''); + + packages = with pkgs; [ + git-crypt + ]; + + commands = with pkgs; [ + (devos (bud {inherit pkgs;}) ) + (devos nixUnstable) + (devos agenix) + { + category = "devos"; + name = pkgs.nvfetcher-bin.pname; + help = pkgs.nvfetcher-bin.meta.description; + command = "cd $DEVSHELL_ROOT/pkgs; ${pkgs.nvfetcher-bin}/bin/nvfetcher -c ./sources.toml --no-output $@; nixpkgs-fmt _sources/"; + } + (linter nixpkgs-fmt) + (linter editorconfig-checker) + # (docs python3Packages.grip) too many deps + (docs mdbook) + ] + + ++ lib.optional + (pkgs ? deploy-rs) + (devos deploy-rs.deploy-rs) + + ++ lib.optional + (system != "i686-linux") + (devos cachix) + + ; +} diff --git a/shell/hooks/default.nix b/shell/hooks/default.nix new file mode 100644 index 00000000..10aa0824 --- /dev/null +++ b/shell/hooks/default.nix @@ -0,0 +1,4 @@ +{ + enable = true; + pre-commit.text = builtins.readFile ./pre-commit.sh; +} diff --git a/shell/hooks/pre-commit.sh b/shell/hooks/pre-commit.sh new file mode 100755 index 00000000..985d3b40 --- /dev/null +++ b/shell/hooks/pre-commit.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=$(${git}/bin/git hash-object -t tree /dev/null) +fi + +diff="git diff-index --name-only --cached $against --diff-filter d" + +nix_files=($($diff -- '*.nix')) +all_files=($($diff)) + +# Format staged nix files. +if [[ -n "${nix_files[@]}" ]]; then + nixpkgs-fmt "${nix_files[@]}" \ + && git add "${nix_files[@]}" +fi + +# check editorconfig +editorconfig-checker -- "${all_files[@]}" +if [[ $? != '0' ]]; then + printf "%b\n" \ + "\nCode is not aligned with .editorconfig" \ + "Review the output and commit your fixes" >&2 + exit 1 +fi From bf59976063db3bdabea6d6e988658c986f7cee13 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Wed, 7 Jul 2021 17:11:59 -0500 Subject: [PATCH 10/22] work-around for https://github.com/NixOS/nix/pull/4641 --- flake.lock | 3 +++ flake.nix | 3 +++ 2 files changed, 6 insertions(+) diff --git a/flake.lock b/flake.lock index 8344bfbe..4e996f76 100644 --- a/flake.lock +++ b/flake.lock @@ -459,6 +459,9 @@ "latest": "latest", "nixos": "nixos", "nixos-hardware": "nixos-hardware", + "nixpkgs": [ + "nixos" + ], "nur": "nur", "nvfetcher": "nvfetcher" } diff --git a/flake.nix b/flake.nix index d409047c..4de566b6 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,9 @@ deploy.url = "github:serokell/deploy-rs"; deploy.inputs.nixpkgs.follows = "nixos"; + # remove after https://github.com/NixOS/nix/pull/4641 + nixpkgs.follows = "nixos"; + ci-agent = { url = "github:hercules-ci/hercules-ci-agent"; inputs = { nix-darwin.follows = "darwin"; nixos-20_09.follows = "nixos"; nixos-unstable.follows = "latest"; }; From fe73d2a0835228d18f83f65d064245c6dcd78727 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Fri, 9 Jul 2021 11:46:01 -0500 Subject: [PATCH 11/22] fix: hm pin to corresponding nixos version --- flake.lock | 7 ++++--- flake.nix | 2 +- users/profiles/direnv/default.nix | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 4e996f76..6833ddc3 100644 --- a/flake.lock +++ b/flake.lock @@ -251,15 +251,16 @@ ] }, "locked": { - "lastModified": 1625694413, - "narHash": "sha256-goRLk1I/OMclS9i17g932wyHyjiKI+htbuFIWIkzTbw=", + "lastModified": 1624228557, + "narHash": "sha256-wwOqe73BsrXfRv1PhyXQFNC8iTET50KvE/HitdkRgxs=", "owner": "nix-community", "repo": "home-manager", - "rev": "06ee8ec8dfc4554c374052cd7b7083765748af99", + "rev": "35a24648d155843a4d162de98c17b1afd5db51e4", "type": "github" }, "original": { "owner": "nix-community", + "ref": "release-21.05", "repo": "home-manager", "type": "github" } diff --git a/flake.nix b/flake.nix index 4de566b6..0727c3b6 100644 --- a/flake.nix +++ b/flake.nix @@ -23,7 +23,7 @@ }; darwin.url = "github:LnL7/nix-darwin"; darwin.inputs.nixpkgs.follows = "latest"; - home.url = "github:nix-community/home-manager"; + home.url = "github:nix-community/home-manager/release-21.05"; home.inputs.nixpkgs.follows = "nixos"; # naersk.url = "github:nmattia/naersk"; # naersk.inputs.nixpkgs.follows = "latest"; diff --git a/users/profiles/direnv/default.nix b/users/profiles/direnv/default.nix index 173a9c58..2b51c9d2 100644 --- a/users/profiles/direnv/default.nix +++ b/users/profiles/direnv/default.nix @@ -1,6 +1,6 @@ { programs.direnv = { enable = true; - enableNixDirenvIntegration = true; + nix-direnv.enable = true; }; } From 6ebdf3adb422c79675d2b919025c7f1367a5a665 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Thu, 15 Jul 2021 17:15:18 -0500 Subject: [PATCH 12/22] imp: reduce flake inputs footprint and increase conciseness --- flake.lock | 273 +++++++++++++++++++++++------------------------------ flake.nix | 54 +++++++---- 2 files changed, 155 insertions(+), 172 deletions(-) diff --git a/flake.lock b/flake.lock index 6833ddc3..a2d429b7 100644 --- a/flake.lock +++ b/flake.lock @@ -20,10 +20,30 @@ "type": "github" } }, + "blank": { + "locked": { + "lastModified": 1625557891, + "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", + "owner": "divnix", + "repo": "blank", + "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "blank", + "type": "github" + } + }, "bud": { "inputs": { - "devshell": "devshell", - "nixpkgs": "nixpkgs" + "devshell": [ + "digga", + "devshell" + ], + "nixpkgs": [ + "nixos" + ] }, "locked": { "lastModified": 1625703505, @@ -41,7 +61,11 @@ }, "ci-agent": { "inputs": { - "flake-compat": "flake-compat", + "flake-compat": [ + "digga", + "deploy", + "flake-compat" + ], "nix-darwin": [ "darwin" ], @@ -89,19 +113,23 @@ }, "deploy": { "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat", "naersk": "naersk", "nixpkgs": [ - "nixos" + "digga", + "nixpkgs" ], - "utils": "utils" + "utils": [ + "digga", + "flake-utils" + ] }, "locked": { - "lastModified": 1625248509, - "narHash": "sha256-G721I9brAMCkZKXIFsgOQ1JCZ9Rj9DM7QSm0pvpQldc=", + "lastModified": 1625729093, + "narHash": "sha256-hpo8T7mlVEpHpZIYqhxqt5i/XY8eu4p66MrAg/MCuVY=", "owner": "serokell", "repo": "deploy-rs", - "rev": "364ef202e400e4c941e18833ca38fa848ac5a148", + "rev": "587cbcfe8d3ea05c5bb153764d3617012ef28c86", "type": "github" }, "original": { @@ -125,38 +153,27 @@ "type": "github" } }, - "devshell_2": { - "locked": { - "lastModified": 1625086391, - "narHash": "sha256-IpNPv1v8s4L3CoxhwcgZIitGpcrnNgnj09X7TA0QV3k=", - "owner": "numtide", - "repo": "devshell", - "rev": "4b5ac7cf7d9a1cc60b965bb51b59922f2210cbc7", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "devshell", - "type": "github" - } - }, "digga": { "inputs": { - "deploy": [ - "deploy" + "blank": "blank", + "deploy": "deploy", + "devshell": "devshell", + "flake-utils": "flake-utils", + "nixlib": [ + "nixos" ], - "devshell": "devshell_2", - "nixlib": "nixlib", "nixos-generators": "nixos-generators", - "nixpkgs": "nixpkgs_2", - "utils": "utils_2" + "nixpkgs": [ + "nixos" + ], + "utils": "utils" }, "locked": { - "lastModified": 1625701039, - "narHash": "sha256-4IqBKop1XmS2z7Y5nsf8Af4wSCYJfy4kXUt/zgPwhSU=", + "lastModified": 1626394163, + "narHash": "sha256-DFMtox9SJBx9kHkn9GhrUkQV3oGovZ/gYRIUwtHJGVk=", "owner": "divnix", "repo": "digga", - "rev": "05ee310fdfa81b1a8ecc7a8075d62ed702d72430", + "rev": "b17d29d897492324176ff616adaf54da2db1e352", "type": "github" }, "original": { @@ -182,60 +199,13 @@ "type": "github" } }, - "flake-compat_2": { - "flake": false, - "locked": { - "lastModified": 1606424373, - "narHash": "sha256-oq8d4//CJOrVj+EcOaSXvMebvuTkmBJuT5tzlfewUnQ=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "99f1c2157fba4bfe6211a321fd0ee43199025dbf", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_3": { - "flake": false, - "locked": { - "lastModified": 1606424373, - "narHash": "sha256-oq8d4//CJOrVj+EcOaSXvMebvuTkmBJuT5tzlfewUnQ=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "99f1c2157fba4bfe6211a321fd0ee43199025dbf", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-utils": { "locked": { - "lastModified": 1623660459, - "narHash": "sha256-OTmOsh43po7r5F9s9H6lVCBQ2b0FikWbmiwLbMAGRdw=", + "lastModified": 1623875721, + "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", "owner": "numtide", "repo": "flake-utils", - "rev": "98c8d36b1828009b20f12544214683c7489935a1", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { - "locked": { - "lastModified": 1620759905, - "narHash": "sha256-WiyWawrgmyN0EdmiHyG2V+fqReiVi8bM9cRdMaKQOFg=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b543720b25df6ffdfcf9227afafc5b8c1fabfae8", + "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", "type": "github" }, "original": { @@ -282,6 +252,7 @@ "naersk": { "inputs": { "nixpkgs": [ + "digga", "deploy", "nixpkgs" ] @@ -301,28 +272,33 @@ "type": "github" } }, - "nixlib": { + "naersk_2": { + "inputs": { + "nixpkgs": [ + "latest" + ] + }, "locked": { - "lastModified": 1620519687, - "narHash": "sha256-+6Dd72b2CASuXm2W7KRxZIE7AOy/dj4mU28vaF+zxcs=", - "owner": "divnix", - "repo": "nixpkgs.lib", - "rev": "c7b6169809c5f74dd0c34f3d69e9d12ba4d448de", + "lastModified": 1623927034, + "narHash": "sha256-sGxlmfp5eXL5sAMNqHSb04Zq6gPl+JeltIZ226OYN0w=", + "owner": "nmattia", + "repo": "naersk", + "rev": "e09c320446c5c2516d430803f7b19f5833781337", "type": "github" }, "original": { - "owner": "divnix", - "repo": "nixpkgs.lib", + "owner": "nmattia", + "repo": "naersk", "type": "github" } }, "nixos": { "locked": { - "lastModified": 1625702791, - "narHash": "sha256-3aiSEfGaBwi1mumzfSgwiO3kxGD+IHe9HAv3S227KI8=", + "lastModified": 1626358428, + "narHash": "sha256-mGXU+tE18/oV2i7+7udpFi0RofrFfjmirMSQan03UGc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "977b522d3101ad847fd51d695b817fe2cf8efaf6", + "rev": "b106a26a4d75dabd51189fd9f4e9c7b96677429c", "type": "github" }, "original": { @@ -333,17 +309,21 @@ }, "nixos-generators": { "inputs": { + "nixlib": [ + "digga", + "nixlib" + ], "nixpkgs": [ "digga", - "nixpkgs" + "blank" ] }, "locked": { - "lastModified": 1624117213, - "narHash": "sha256-hAoBANafVdM/+8Z6PrlPEKPN6LrdkM4qg2Q/ji0XUns=", + "lastModified": 1624973746, + "narHash": "sha256-11JbJRduNwyf556gndGErR5/12ceyHOHBfEuha5Vws4=", "owner": "nix-community", "repo": "nixos-generators", - "rev": "c64d3c2153274a6ab355e57f5eedfe6f85073d24", + "rev": "022ef440af8dc237ab1f59fa363cb1e25783ec3e", "type": "github" }, "original": { @@ -367,42 +347,13 @@ "type": "github" } }, - "nixpkgs": { - "locked": { - "lastModified": 1624831744, - "narHash": "sha256-gGSxxnWnXRALLKfStsG3C4X+XUzAkHlKx02xHzkGZio=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "dbf5cd2d90cbf8b281c1938632b431d1e61d3249", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1624148921, - "narHash": "sha256-FAhKTXZV67C36hK5lPvZfsFt+QY1QSHYQXwGXqpOChs=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "f2122ea5815648effdd97157c7bf4e9a1a6dbb34", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixpkgs", - "type": "github" - } - }, "nur": { "locked": { - "lastModified": 1625695235, - "narHash": "sha256-xJ8jHWkX7IyAImQ8MpWTbUonski38R4bWDNs8pJJzpk=", + "lastModified": 1626378135, + "narHash": "sha256-koC6DBYmLCrgXA+AMHVaODf1uHYPmvcFygHfy3eg6vI=", "owner": "nix-community", "repo": "NUR", - "rev": "9e2254aee0cce4b05f27447e51c001ab66aed7e0", + "rev": "00c2ec8f0bbdf0cfb2135bde55fbae5d6b64aa6d", "type": "github" }, "original": { @@ -412,8 +363,16 @@ }, "nvfetcher": { "inputs": { - "flake-compat": "flake-compat_3", - "flake-utils": "flake-utils_2", + "flake-compat": [ + "digga", + "deploy", + "flake-compat" + ], + "flake-utils": [ + "digga", + "utils", + "flake-utils" + ], "nixpkgs": [ "latest" ] @@ -451,47 +410,55 @@ "root": { "inputs": { "agenix": "agenix", + "blank": [ + "digga", + "blank" + ], "bud": "bud", "ci-agent": "ci-agent", "darwin": "darwin", - "deploy": "deploy", + "deploy": [ + "digga", + "deploy" + ], "digga": "digga", + "flake-utils": [ + "digga", + "flake-utils" + ], "home": "home", "latest": "latest", + "naersk": "naersk_2", + "nixlib": [ + "digga", + "nixlib" + ], "nixos": "nixos", "nixos-hardware": "nixos-hardware", "nixpkgs": [ "nixos" ], "nur": "nur", - "nvfetcher": "nvfetcher" + "nvfetcher": "nvfetcher", + "utils": [ + "digga", + "utils" + ] } }, "utils": { - "locked": { - "lastModified": 1622445595, - "narHash": "sha256-m+JRe6Wc5OZ/mKw2bB3+Tl0ZbtyxxxfnAWln8Q5qs+Y=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "7d706970d94bc5559077eb1a6600afddcd25a7c8", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "utils_2": { "inputs": { - "flake-utils": "flake-utils" + "flake-utils": [ + "digga", + "flake-utils" + ] }, "locked": { - "lastModified": 1624128793, - "narHash": "sha256-yZYvpT6i6iRK0x1a8k/LCoS7JGLVk6Yi1eqfhatnDLk=", + "lastModified": 1624737817, + "narHash": "sha256-styqXE6Xli61dnDst0vB0Kb1tPt/aCuxOhTK0uGDCng=", "owner": "gytis-ivaskevicius", "repo": "flake-utils-plus", - "rev": "785e6f13b8c6131d1eee625a713e8475b2b0512b", + "rev": "6bf0d314fc5623d5d4b5240ee0bf0a3a270d717c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 0727c3b6..90037bd5 100644 --- a/flake.nix +++ b/flake.nix @@ -5,34 +5,50 @@ { nixos.url = "nixpkgs/release-21.05"; latest.url = "nixpkgs"; - digga = { - url = "github:divnix/digga/develop"; - inputs.nipxkgs.follows = "latest"; - inputs.deploy.follows = "deploy"; - }; - bud.url = "github:divnix/bud"; # no need to follow nixpkgs: it never materialises - deploy.url = "github:serokell/deploy-rs"; - deploy.inputs.nixpkgs.follows = "nixos"; - # remove after https://github.com/NixOS/nix/pull/4641 - nixpkgs.follows = "nixos"; + digga.url = "github:divnix/digga/develop"; + digga.inputs.nixpkgs.follows = "nixos"; + digga.inputs.nixlib.follows = "nixos"; + + bud.url = "github:divnix/bud"; + bud.inputs.nixpkgs.follows = "nixos"; + bud.inputs.devshell.follows = "digga/devshell"; - ci-agent = { - url = "github:hercules-ci/hercules-ci-agent"; - inputs = { nix-darwin.follows = "darwin"; nixos-20_09.follows = "nixos"; nixos-unstable.follows = "latest"; }; - }; - darwin.url = "github:LnL7/nix-darwin"; - darwin.inputs.nixpkgs.follows = "latest"; home.url = "github:nix-community/home-manager/release-21.05"; home.inputs.nixpkgs.follows = "nixos"; - # naersk.url = "github:nmattia/naersk"; - # naersk.inputs.nixpkgs.follows = "latest"; + + darwin.url = "github:LnL7/nix-darwin"; + darwin.inputs.nixpkgs.follows = "latest"; + + deploy.follows = "digga/deploy"; + agenix.url = "github:ryantm/agenix"; agenix.inputs.nixpkgs.follows = "latest"; - nixos-hardware.url = "github:nixos/nixos-hardware"; nvfetcher.url = "github:berberman/nvfetcher"; nvfetcher.inputs.nixpkgs.follows = "latest"; + nvfetcher.inputs.flake-compat.follows = "digga/deploy/flake-compat"; + nvfetcher.inputs.flake-utils.follows = "digga/utils/flake-utils"; + + ci-agent.url = "github:hercules-ci/hercules-ci-agent"; + ci-agent.inputs.nix-darwin.follows = "darwin"; + ci-agent.inputs.nixos-20_09.follows = "nixos"; + ci-agent.inputs.nixos-unstable.follows = "latest"; + ci-agent.inputs.flake-compat.follows = "digga/deploy/flake-compat"; + + naersk.url = "github:nmattia/naersk"; + naersk.inputs.nixpkgs.follows = "latest"; + + nixos-hardware.url = "github:nixos/nixos-hardware"; + + # start ANTI CORRUPTION LAYER + # remove after https://github.com/NixOS/nix/pull/4641 + nixpkgs.follows = "nixos"; + nixlib.follows = "digga/nixlib"; + blank.follows = "digga/blank"; + utils.follows = "digga/utils"; + flake-utils.follows = "digga/flake-utils"; + # end ANTI CORRUPTION LAYER }; outputs = From 000329f6a75529dda55b5f432827aadd96bf5029 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Thu, 15 Jul 2021 22:19:38 -0500 Subject: [PATCH 13/22] fix: bump digga with infinite recursion hotfix --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index a2d429b7..092f2d3c 100644 --- a/flake.lock +++ b/flake.lock @@ -169,11 +169,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1626394163, - "narHash": "sha256-DFMtox9SJBx9kHkn9GhrUkQV3oGovZ/gYRIUwtHJGVk=", + "lastModified": 1626404753, + "narHash": "sha256-Ag/e7tecRg19FS+B5kKXu3KTwiNlM/C8saofKvYPC8A=", "owner": "divnix", "repo": "digga", - "rev": "b17d29d897492324176ff616adaf54da2db1e352", + "rev": "ed0dc961c121db31ac05d19937e1482ce55ff599", "type": "github" }, "original": { From 4b9cab40cb1c5d7989c2e3719d743e764128ac2a Mon Sep 17 00:00:00 2001 From: David Arnold Date: Mon, 12 Jul 2021 17:32:13 -0500 Subject: [PATCH 14/22] imp: add portable user definition According to https://github.com/nix-community/home-manager/issues/2161 there might be a better formal distinction between host-spaced and portable arch-spaced hm users in the future. --- flake.lock | 15 +++++++++------ flake.nix | 4 ++++ users/nixos/default.nix | 6 ++---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index 092f2d3c..cc36263a 100644 --- a/flake.lock +++ b/flake.lock @@ -159,6 +159,9 @@ "deploy": "deploy", "devshell": "devshell", "flake-utils": "flake-utils", + "home-manager": [ + "home" + ], "nixlib": [ "nixos" ], @@ -169,11 +172,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1626404753, - "narHash": "sha256-Ag/e7tecRg19FS+B5kKXu3KTwiNlM/C8saofKvYPC8A=", + "lastModified": 1626451343, + "narHash": "sha256-TXHFFYJhkMknpb1l0nuCfHtOMLNabAKYY5XE2p8HFM0=", "owner": "divnix", "repo": "digga", - "rev": "ed0dc961c121db31ac05d19937e1482ce55ff599", + "rev": "37e5542b03e5da27ff7d2ed801fa118c2b87bf02", "type": "github" }, "original": { @@ -454,11 +457,11 @@ ] }, "locked": { - "lastModified": 1624737817, - "narHash": "sha256-styqXE6Xli61dnDst0vB0Kb1tPt/aCuxOhTK0uGDCng=", + "lastModified": 1626288344, + "narHash": "sha256-TioHDqWJkw37jjx4DVrH6LCzwrUfAqXbWl4rKR91fpA=", "owner": "gytis-ivaskevicius", "repo": "flake-utils-plus", - "rev": "6bf0d314fc5623d5d4b5240ee0bf0a3a270d717c", + "rev": "5c6ee69f6957afc2fe22c094717d6d78516418b5", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 90037bd5..cf0193a4 100644 --- a/flake.nix +++ b/flake.nix @@ -9,6 +9,7 @@ digga.url = "github:divnix/digga/develop"; digga.inputs.nixpkgs.follows = "nixos"; digga.inputs.nixlib.follows = "nixos"; + digga.inputs.home-manager.follows = "home"; bud.url = "github:divnix/bud"; bud.inputs.nixpkgs.follows = "nixos"; @@ -136,6 +137,9 @@ base = [ direnv git ]; }; }; + users = { + nixos = { suites, ... }: { imports = suites.base; }; + }; # digga.lib.importers.rakeLeaves ./users/hm; }; devshell.modules = [ (import ./shell bud') ]; diff --git a/users/nixos/default.nix b/users/nixos/default.nix index 700467b9..5c037fe8 100644 --- a/users/nixos/default.nix +++ b/users/nixos/default.nix @@ -1,8 +1,6 @@ -{ ... }: +{ hmUsers, ... }: { - home-manager.users.nixos = { suites, ... }: { - imports = suites.base; - }; + home-manager.users = { inherit (hmUsers) nixos; }; users.users.nixos = { uid = 1000; From b95189d754a0afd3f8d119dda036a483131283de Mon Sep 17 00:00:00 2001 From: David Arnold Date: Fri, 16 Jul 2021 12:45:48 -0500 Subject: [PATCH 15/22] rm: community the commmunity branch was fallen too far behind and there where no contributions to it, anyways. We will start linking usage examples out in the wild, instead. --- README.md | 17 +++-------------- doc/CONTRIBUTING.md | 6 ------ doc/concepts/profiles.md | 3 --- doc/concepts/suites.md | 2 +- doc/flk/get.md | 6 +++--- doc/start/index.md | 2 -- pkgs/bud/default.nix | 2 +- pkgs/bud/get.bash | 7 +------ 8 files changed, 9 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 78c30ea4..01b92e6c 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,6 @@ Also, have a look at [_flake.nix_][toc]. If anything is not immediately discoverable from there through [`digga`][digga] library's [`mkFlake`][mk-flake], please file a bug report. -## In the Wild -The author maintains his own branch, so you can take inspiration, direction, or -make critical comments about the [code][please]. 😜 - ## Motivation NixOS provides an amazing abstraction to manage our environment, but that new power can sometimes bring feelings of overwhelm and confusion. Having a turing @@ -46,16 +42,9 @@ and its satellite projects, from which best practices can evolve. ___The future is declarative! 🎉___ -## Community Profiles -There are two branches from which to choose: [core][core] and -[community][community]. The community branch builds on core and includes -several ready-made profiles for discretionary use. - -Every package and NixOS profile declared in community is uploaded to -[cachix](./integrations/cachix.md), so everything provided is available -without building anything. This is especially useful for the packages that are -[overridden](./concepts/overrides.md) from master, as without the cache, -rebuilds are quite frequent. +## Examples in the Wild +The author maintains his own branch, so you can take inspiration, direction, or +make critical comments about the [code][please]. 😜 ## Shoulders This work does not reinvent the wheel. It stands on the [shoulders of the diff --git a/doc/CONTRIBUTING.md b/doc/CONTRIBUTING.md index f7210697..4766cdf7 100644 --- a/doc/CONTRIBUTING.md +++ b/doc/CONTRIBUTING.md @@ -10,12 +10,6 @@ rendered on every change, so the docs should always be up to date. We also use [BORS](https://bors.tech) to ensure that all pull requests pass the test suite once at least one review is completed. -## Community PRs -While much of your work in this template may be idiosyncratic in nature. Anything -that might be generally useful to the broader NixOS community can be synced to -the `community` branch to provide a host of useful NixOS configurations available -"out of the box". - # Style If you wish to contribute please follow these guidelines: diff --git a/doc/concepts/profiles.md b/doc/concepts/profiles.md index b4ff0a19..a5eda3e2 100644 --- a/doc/concepts/profiles.md +++ b/doc/concepts/profiles.md @@ -5,9 +5,6 @@ Profiles are a convenient shorthand for the [_definition_][definition] of built into the NixOS module system for a reason: to elegantly provide a clear separation of concerns. -If you need guidance, a community [branch](https://github.com/divnix/devos/tree/community/profiles) -is maintained to help get up to speed on their usage. - ## Creation Profiles are created with the `rakeLeaves` function which recursively collects `.nix` files from within a folder. The recursion stops at folders with a `default.nix` diff --git a/doc/concepts/suites.md b/doc/concepts/suites.md index e120ad67..42a3db82 100644 --- a/doc/concepts/suites.md +++ b/doc/concepts/suites.md @@ -1,6 +1,6 @@ # Suites Suites provide a mechanism for users to easily combine and name collecitons of -profiles. For good examples, check out the suites defined in the community branch. +profiles. `suites` are defined in the `importables` argument in either the `home` or `nixos` namespace. They are a special case of an `importable` which get passed as a special diff --git a/doc/flk/get.md b/doc/flk/get.md index b1f79906..8761f004 100644 --- a/doc/flk/get.md +++ b/doc/flk/get.md @@ -1,10 +1,10 @@ # get The `get` subcommand is useful for getting a bare copy of devos without the -git history. You can pull either the core or community branches. +git history. ## Usage ```sh -flk get BRANCH DEST-DIR +flk get DEST-DIR ``` -If DEST-DIR is ommitted, it defaults to _./flk_. +If DEST-DIR is ommitted, it defaults to _./devos_. diff --git a/doc/start/index.md b/doc/start/index.md index fbfab099..f3f1127f 100644 --- a/doc/start/index.md +++ b/doc/start/index.md @@ -25,8 +25,6 @@ version required. In addition, the [binary cache](../integrations/cachix.md) is added for faster deployment. > ##### _Notes:_ -> - You can change `core` to [`community`](../../index.md#community-profiles) -> in the call to `flk get` > - Flakes ignore files that have not been added to git, so be sure to stage new > files before building the system. > - You can choose to simply clone the repo with git if you want to follow diff --git a/pkgs/bud/default.nix b/pkgs/bud/default.nix index f96e1737..c486636b 100644 --- a/pkgs/bud/default.nix +++ b/pkgs/bud/default.nix @@ -2,7 +2,7 @@ bud.cmds = with pkgs; { get = { writer = budUtils.writeBashWithPaths [ nixUnstable git coreutils ]; - synopsis = "get (core|community) [DEST]"; + synopsis = "get [DEST]"; help = "Copy the desired template to DEST"; script = ./get.bash; }; diff --git a/pkgs/bud/get.bash b/pkgs/bud/get.bash index 15c834a2..3b4d9a74 100644 --- a/pkgs/bud/get.bash +++ b/pkgs/bud/get.bash @@ -1,6 +1 @@ -if [[ "$1" == "core" || "$1" == "community" ]]; then - nix flake new -t "github:divnix/devos/$1" "${2:-devos}" -else - echo "bud get (core|community) [DEST]" - exit 1 -fi +nix flake new -t "github:divnix/devos/core" "${2:-devos}" From 26a2423312fccdbc4899506f91e2c084e7899aec Mon Sep 17 00:00:00 2001 From: David Arnold Date: Fri, 9 Jul 2021 10:17:05 -0500 Subject: [PATCH 16/22] ref: make hm common module explicit --- modules/customBuilds.nix | 15 --------------- modules/hm-system-defaults.nix | 11 +++++++++++ 2 files changed, 11 insertions(+), 15 deletions(-) create mode 100644 modules/hm-system-defaults.nix diff --git a/modules/customBuilds.nix b/modules/customBuilds.nix index cbaefe3c..d7757c6b 100644 --- a/modules/customBuilds.nix +++ b/modules/customBuilds.nix @@ -7,20 +7,5 @@ fullHostConfig = config; }) ).config.system.build.isoImage; - - homes = (config.lib.digga.mkBuild - ({ config, ... }: { - home-manager.useUserPackages = lib.mkForce false; - home-manager.sharedModules = [ - { - home.sessionVariables = { - inherit (config.environment.sessionVariables) NIX_PATH; - }; - xdg.configFile."nix/registry.json".text = - config.environment.etc."nix/registry.json".text; - } - ]; - }) - ).config.home-manager.users; }; } diff --git a/modules/hm-system-defaults.nix b/modules/hm-system-defaults.nix new file mode 100644 index 00000000..7b442a61 --- /dev/null +++ b/modules/hm-system-defaults.nix @@ -0,0 +1,11 @@ +{ config, ... }: { + home-manager.sharedModules = [ + { + home.sessionVariables = { + inherit (config.environment.sessionVariables) NIX_PATH; + }; + xdg.configFile."nix/registry.json".text = + config.environment.etc."nix/registry.json".text; + } + ]; +} From bd0ef12149c4b0c19e84670e40b036bfbcbdaf45 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Fri, 16 Jul 2021 12:21:57 -0500 Subject: [PATCH 17/22] bump: pull in latest bud fixes & additions - portble home profiles - missing coreutils --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index cc36263a..74b2ded8 100644 --- a/flake.lock +++ b/flake.lock @@ -46,11 +46,11 @@ ] }, "locked": { - "lastModified": 1625703505, - "narHash": "sha256-PNtHOR5wp3R/cysCHTIFcxCHHuisljbrS6iNyP/Ivfk=", + "lastModified": 1626456025, + "narHash": "sha256-TrKfxVir+TilnqSNYokxJKx2ugEem7Khv4YmSwqj9JQ=", "owner": "divnix", "repo": "bud", - "rev": "baefc56e5819375736b51e93df9e2154a120ea3d", + "rev": "59c10c3879b11371944ab664462fe2e9366cfb44", "type": "github" }, "original": { @@ -172,11 +172,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1626451343, - "narHash": "sha256-TXHFFYJhkMknpb1l0nuCfHtOMLNabAKYY5XE2p8HFM0=", + "lastModified": 1626458006, + "narHash": "sha256-mncfFzXwOLgLW8DkloEuyzSySsCtcKnn6Xe1LImVXHQ=", "owner": "divnix", "repo": "digga", - "rev": "37e5542b03e5da27ff7d2ed801fa118c2b87bf02", + "rev": "73d6ed3ba3d1430c1db3ead770ffd991f7d3c97b", "type": "github" }, "original": { From b05f95065e52f8451625f5e08a212f6bf33f4436 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Fri, 16 Jul 2021 13:18:10 -0500 Subject: [PATCH 18/22] bump: point to tip of squashed digga develop branch --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 74b2ded8..15c1633d 100644 --- a/flake.lock +++ b/flake.lock @@ -172,11 +172,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1626458006, - "narHash": "sha256-mncfFzXwOLgLW8DkloEuyzSySsCtcKnn6Xe1LImVXHQ=", + "lastModified": 1626459181, + "narHash": "sha256-68H1YDk5v7FNXCV/pRkunA3PI4V8GiXrcHYnnvQOHQM=", "owner": "divnix", "repo": "digga", - "rev": "73d6ed3ba3d1430c1db3ead770ffd991f7d3c97b", + "rev": "ab4f3236cfb0264fc844d983be518eb37fc97fc0", "type": "github" }, "original": { From 8ae22c63dc9eb0956ec26ca90dd7bef495be4404 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Fri, 16 Jul 2021 15:27:17 -0500 Subject: [PATCH 19/22] fix: move legacy nix path definitions back to devos --- modules/nix-path.nix | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 modules/nix-path.nix diff --git a/modules/nix-path.nix b/modules/nix-path.nix new file mode 100644 index 00000000..273f67a6 --- /dev/null +++ b/modules/nix-path.nix @@ -0,0 +1,7 @@ +{ channel, inputs, ... }: { + nix.nixPath = [ + "nixpkgs=${channel.input}" + "nixos-config=${../lib/compat/nixos}" + "home-manager=${inputs.home}" + ]; +} From aa45592c1735b5016b9cea835f49657eb2b02928 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Fri, 16 Jul 2021 15:35:55 -0500 Subject: [PATCH 20/22] imp: add digga's nixConfig and patchedNix --- flake.lock | 6 +++--- flake.nix | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 15c1633d..3b84f5bd 100644 --- a/flake.lock +++ b/flake.lock @@ -172,11 +172,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1626459181, - "narHash": "sha256-68H1YDk5v7FNXCV/pRkunA3PI4V8GiXrcHYnnvQOHQM=", + "lastModified": 1626470112, + "narHash": "sha256-hC5I3A1HxfGi45avpYBf8zXi1hQkHYWgRgUM4sF9byI=", "owner": "divnix", "repo": "digga", - "rev": "ab4f3236cfb0264fc844d983be518eb37fc97fc0", + "rev": "f25928ed0bf05ab20af5a8231d264ae01b42ab34", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index cf0193a4..366fef88 100644 --- a/flake.nix +++ b/flake.nix @@ -78,6 +78,7 @@ nixos = { imports = [ (digga.lib.importers.overlays ./overlays) ]; overlays = [ + digga.overlays.patchedNix nur.overlay agenix.overlay nvfetcher.overlay @@ -106,6 +107,7 @@ imports = [ (digga.lib.importers.modules ./modules) ]; externalModules = [ { lib.our = self.lib; } + digga.nixosModules.nixConfig ci-agent.nixosModules.agent-profile home.nixosModules.home-manager agenix.nixosModules.age From 6c25e77f6fc3e4c0fa0eb009aae48a817b6bac51 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Fri, 16 Jul 2021 16:09:26 -0500 Subject: [PATCH 21/22] add flake's nixConfig values that go well with this repo --- flake.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/flake.nix b/flake.nix index 366fef88..c60f6f40 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,10 @@ { description = "A highly structured configuration database."; + nixConfig.extra-experimental-features = "nix-command flakes ca-references"; + nixConfig.extra-substituters = "https://nrdxp.cachix.org https://nix-community.cachix.org"; + nixConfig.extra-trusted-public-keys = "nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="; + inputs = { nixos.url = "nixpkgs/release-21.05"; From a088edd77ae40203d31f55dc8478548f07b8c9a0 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Fri, 16 Jul 2021 16:01:25 -0500 Subject: [PATCH 22/22] fmt --- flake.nix | 145 ++++++++++++++++--------------- overlays/various-flake-fixes.nix | 8 +- shell/default.nix | 5 +- shell/hooks/default.nix | 2 +- 4 files changed, 82 insertions(+), 78 deletions(-) diff --git a/flake.nix b/flake.nix index c60f6f40..d9f6d0a8 100644 --- a/flake.nix +++ b/flake.nix @@ -73,92 +73,93 @@ let bud' = bud self; # rebind to access self.budModules in - digga.lib.mkFlake { - inherit self inputs; + digga.lib.mkFlake + { + inherit self inputs; - channelsConfig = { allowUnfree = true; }; + channelsConfig = { allowUnfree = true; }; + + channels = { + nixos = { + imports = [ (digga.lib.importers.overlays ./overlays) ]; + overlays = [ + digga.overlays.patchedNix + nur.overlay + agenix.overlay + nvfetcher.overlay + deploy.overlay + ./pkgs/default.nix + ]; + }; + latest = { }; + }; + + lib = import ./lib { lib = digga.lib // nixos.lib; }; + + sharedOverlays = [ + (final: prev: { + __dontExport = true; + lib = prev.lib.extend (lfinal: lprev: { + our = self.lib; + }); + }) + ]; - channels = { nixos = { - imports = [ (digga.lib.importers.overlays ./overlays) ]; - overlays = [ - digga.overlays.patchedNix - nur.overlay - agenix.overlay - nvfetcher.overlay - deploy.overlay - ./pkgs/default.nix - ]; - }; - latest = { }; - }; - - lib = import ./lib { lib = digga.lib // nixos.lib; }; - - sharedOverlays = [ - (final: prev: { - __dontExport = true; - lib = prev.lib.extend (lfinal: lprev: { - our = self.lib; - }); - }) - ]; - - nixos = { - hostDefaults = { - system = "x86_64-linux"; - channelName = "nixos"; - imports = [ (digga.lib.importers.modules ./modules) ]; - externalModules = [ - { lib.our = self.lib; } - digga.nixosModules.nixConfig - ci-agent.nixosModules.agent-profile - home.nixosModules.home-manager - agenix.nixosModules.age - (bud.nixosModules.bud bud') - ]; - }; - - imports = [ (digga.lib.importers.hosts ./hosts) ]; - hosts = { - /* set host specific properties here */ - NixOS = { }; - }; - importables = rec { - profiles = digga.lib.importers.rakeLeaves ./profiles // { - users = digga.lib.importers.rakeLeaves ./users; + hostDefaults = { + system = "x86_64-linux"; + channelName = "nixos"; + imports = [ (digga.lib.importers.modules ./modules) ]; + externalModules = [ + { lib.our = self.lib; } + digga.nixosModules.nixConfig + ci-agent.nixosModules.agent-profile + home.nixosModules.home-manager + agenix.nixosModules.age + (bud.nixosModules.bud bud') + ]; }; - suites = with profiles; rec { - base = [ core users.nixos users.root ]; + + imports = [ (digga.lib.importers.hosts ./hosts) ]; + hosts = { + /* set host specific properties here */ + NixOS = { }; + }; + importables = rec { + profiles = digga.lib.importers.rakeLeaves ./profiles // { + users = digga.lib.importers.rakeLeaves ./users; + }; + suites = with profiles; rec { + base = [ core users.nixos users.root ]; + }; }; }; - }; - home = { - imports = [ (digga.lib.importers.modules ./users/modules) ]; - externalModules = [ ]; - importables = rec { - profiles = digga.lib.importers.rakeLeaves ./users/profiles; - suites = with profiles; rec { - base = [ direnv git ]; + home = { + imports = [ (digga.lib.importers.modules ./users/modules) ]; + externalModules = [ ]; + importables = rec { + profiles = digga.lib.importers.rakeLeaves ./users/profiles; + suites = with profiles; rec { + base = [ direnv git ]; + }; }; + users = { + nixos = { suites, ... }: { imports = suites.base; }; + }; # digga.lib.importers.rakeLeaves ./users/hm; }; - users = { - nixos = { suites, ... }: { imports = suites.base; }; - }; # digga.lib.importers.rakeLeaves ./users/hm; - }; - devshell.modules = [ (import ./shell bud') ]; + devshell.modules = [ (import ./shell bud') ]; - homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; + homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; - deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { }; + deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { }; - defaultTemplate = self.templates.bud; - templates.bud.path = ./.; - templates.bud.description = "bud template"; + defaultTemplate = self.templates.bud; + templates.bud.path = ./.; + templates.bud.description = "bud template"; - } + } // { budModules = { devos = import ./pkgs/bud; }; diff --git a/overlays/various-flake-fixes.nix b/overlays/various-flake-fixes.nix index 2bb1f70d..7dbfc18b 100644 --- a/overlays/various-flake-fixes.nix +++ b/overlays/various-flake-fixes.nix @@ -2,8 +2,10 @@ final: prev: { # Since: https://github.com/NixOS/nixpkgs/pull/126137 nix-direnv = if builtins.hasAttr "enableFlakes" prev.nix-direnv.override.__functionArgs - then prev.nix-direnv.override { - enableFlakes = true; - } + then + prev.nix-direnv.override + { + enableFlakes = true; + } else prev.nix-direnv; } diff --git a/shell/default.nix b/shell/default.nix index 8b67e1dc..edad83c0 100644 --- a/shell/default.nix +++ b/shell/default.nix @@ -9,7 +9,8 @@ let docs = pkgWithCategory "docs"; devos = pkgWithCategory "devos"; -in { +in +{ _file = toString ./.; imports = [ "${extraModulesPath}/git/hooks.nix" ]; @@ -35,7 +36,7 @@ in { ]; commands = with pkgs; [ - (devos (bud {inherit pkgs;}) ) + (devos (bud { inherit pkgs; })) (devos nixUnstable) (devos agenix) { diff --git a/shell/hooks/default.nix b/shell/hooks/default.nix index 10aa0824..10f2c9d2 100644 --- a/shell/hooks/default.nix +++ b/shell/hooks/default.nix @@ -1,4 +1,4 @@ { enable = true; - pre-commit.text = builtins.readFile ./pre-commit.sh; + pre-commit.text = builtins.readFile ./pre-commit.sh; }