diff --git a/README.md b/README.md index fc5bb769..864d2535 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ Also, have a look at [_flake.nix_][toc]. If anything is not immediately discoverable via "[`digga`][digga]'s [`mkFlake`][mk-flake], please file a bug report. +<<<<<<< HEAD ## 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 @@ -34,6 +35,16 @@ ___The future is declarative! 🎉___ ## Examples in the Wild The author maintains his own branch, so you can take inspiration, direction, or make critical comments about the [code][please]. 😜 +======= +### Status: Beta +Although this project has already matured quite a bit, especially through +recent outfactoring of [`digga`][digga], a fair amount of api polishing is still +expected. There are unstable versions (0._x_._x_) to help users keep track +of changes and progress, and a [`develop`](https://github.com/divnix/devos/tree/develop) branch for the brave 😜 + +## In the Wild +* The original [authors][please] +>>>>>>> devos/develop ## Shoulders This work does not reinvent the wheel. It stands on the [shoulders of the @@ -92,4 +103,3 @@ DevOS is licensed under the [MIT License][mit]. [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 868ba07e..a2b5ef9d 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1620877075, - "narHash": "sha256-XvgTqtmQZHegu9UMDSR50gK5cHEM2gbnRH0qecmdN54=", + "lastModified": 1626960455, + "narHash": "sha256-N3+qOtsADo59UcG8PxqNMhT94wqTQ73k08gpy1dLaWU=", "owner": "ryantm", "repo": "agenix", - "rev": "e543aa7d68f222e1e771165da9e9a64b5bf7b3e3", + "rev": "fb00f178b3a49a39cc964049075439b575d36d60", "type": "github" }, "original": { @@ -46,11 +46,11 @@ ] }, "locked": { - "lastModified": 1626456025, - "narHash": "sha256-TrKfxVir+TilnqSNYokxJKx2ugEem7Khv4YmSwqj9JQ=", + "lastModified": 1627447597, + "narHash": "sha256-e7q4jCq7MPHTa0HKxX5fJS1JwZ33BN9WohWUy6sOOgA=", "owner": "divnix", "repo": "bud", - "rev": "59c10c3879b11371944ab664462fe2e9366cfb44", + "rev": "231fa20ed93944e5b484cb5d820c60c17f4dfc35", "type": "github" }, "original": { @@ -59,38 +59,6 @@ "type": "github" } }, - "ci-agent": { - "inputs": { - "flake-compat": [ - "digga", - "deploy", - "flake-compat" - ], - "nix-darwin": [ - "darwin" - ], - "nixos-20_09": [ - "nixos" - ], - "nixos-unstable": [ - "latest" - ], - "pre-commit-hooks-nix": "pre-commit-hooks-nix" - }, - "locked": { - "lastModified": 1626066948, - "narHash": "sha256-rBo4nCPyAHb1e/9ysYGH7tW1FV0N2XNvRcJR+g8gugA=", - "owner": "hercules-ci", - "repo": "hercules-ci-agent", - "rev": "7f3265cc42d5f364066c145939ee2812938b991c", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "hercules-ci-agent", - "type": "github" - } - }, "darwin": { "inputs": { "nixpkgs": [ @@ -116,9 +84,11 @@ "flake-compat": "flake-compat", "naersk": "naersk", "nixpkgs": [ + "digga", "nixpkgs" ], "utils": [ + "digga", "flake-utils" ] }, @@ -157,6 +127,7 @@ "deploy": "deploy", "devshell": "devshell", "flake-utils": "flake-utils", + "flake-utils-plus": "flake-utils-plus", "home-manager": [ "home" ], @@ -166,20 +137,18 @@ "nixos-generators": "nixos-generators", "nixpkgs": [ "nixos" - ], - "utils": "utils" + ] }, "locked": { - "lastModified": 1626470112, - "narHash": "sha256-hC5I3A1HxfGi45avpYBf8zXi1hQkHYWgRgUM4sF9byI=", + "lastModified": 1627438622, + "narHash": "sha256-O+e35MsI/E07CleYSHfWUhaSYcl7Rg/kf0O+hUi7vto=", "owner": "divnix", "repo": "digga", - "rev": "f25928ed0bf05ab20af5a8231d264ae01b42ab34", + "rev": "0778eeeb665d4f922d7befe56be220c342406337", "type": "github" }, "original": { "owner": "divnix", - "ref": "develop", "repo": "digga", "type": "github" } @@ -215,13 +184,35 @@ "type": "github" } }, + "flake-utils-plus": { + "inputs": { + "flake-utils": [ + "digga", + "flake-utils" + ] + }, + "locked": { + "lastModified": 1627071952, + "narHash": "sha256-FhE0KOuI9Kl4eyGJXu4bh9fBP2hbxjnD1DlKHljCcYs=", + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "rev": "51a82925db31073bc4822c9b538a0a3ebf1134b2", + "type": "github" + }, + "original": { + "owner": "gytis-ivaskevicius", + "ref": "staging", + "repo": "flake-utils-plus", + "type": "github" + } + }, "flake-utils_2": { "locked": { - "lastModified": 1619345332, - "narHash": "sha256-qHnQkEp1uklKTpx3MvKtY6xzgcqXDsz5nLilbbuL+3A=", + "lastModified": 1623875721, + "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", "owner": "numtide", "repo": "flake-utils", - "rev": "2ebf2558e5bf978c7fb8ea927dfaed8fefab2e28", + "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", "type": "github" }, "original": { @@ -237,11 +228,11 @@ ] }, "locked": { - "lastModified": 1624228557, - "narHash": "sha256-wwOqe73BsrXfRv1PhyXQFNC8iTET50KvE/HitdkRgxs=", + "lastModified": 1627158444, + "narHash": "sha256-+C0SqhyQQplhcmWl681ODGNWUng8Wp1yvC/MdI1Q7hY=", "owner": "nix-community", "repo": "home-manager", - "rev": "35a24648d155843a4d162de98c17b1afd5db51e4", + "rev": "9c0abed5228d54aad120b4bc757b6f5935aeda1c", "type": "github" }, "original": { @@ -253,12 +244,11 @@ }, "latest": { "locked": { - "lastModified": 1626529037, - "narHash": "sha256-Q1vbk2fgE43JgjvTBdghZ70ParF2ek/jTn62ACkU8Fw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5f069e17541ac5cd240fced18687cef190080be3", - "type": "github" + "lastModified": 1626527571, + "narHash": "sha256-+X2GhKfkuLUYs8wVQPUKZULX3OvaNn2KwrvhoxQk9SA=", + "path": "/nix/store/a7qndnxr415j8s2172g13xhs1ryn5rcs-source", + "rev": "0a96dbc8b6bd4874ef0f55ce30ec7bdf1cb09452", + "type": "path" }, "original": { "id": "nixpkgs", @@ -268,7 +258,9 @@ "naersk": { "inputs": { "nixpkgs": [ - "latest" + "digga", + "deploy", + "nixpkgs" ] }, "locked": { @@ -312,11 +304,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1620663773, - "narHash": "sha256-Nfc2g9xUCPYBFKE5O7OdrDpCVspwk64S8EbsDYoY38c=", + "lastModified": 1626702694, + "narHash": "sha256-YarKJzVh4De/EsMA3IYLbLzf4Qc5yH5mDcYNuYJqpP4=", "owner": "dramforever", "repo": "nix-dram", - "rev": "86485e22621b17bcc4472889eedbd562498bb5a2", + "rev": "b7cd3eba2567ccc662f288ca5bc46003d78f9dbb", "type": "github" }, "original": { @@ -327,11 +319,11 @@ }, "nixos": { "locked": { - "lastModified": 1626527571, - "narHash": "sha256-+X2GhKfkuLUYs8wVQPUKZULX3OvaNn2KwrvhoxQk9SA=", + "lastModified": 1627460592, + "narHash": "sha256-jdJqJi9DSPiGOY9xlZSi0ufDJpS6ezvDdx8AQq5VuyI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0a96dbc8b6bd4874ef0f55ce30ec7bdf1cb09452", + "rev": "382039c05a16827a7f0731183e862366b66b422f", "type": "github" }, "original": { @@ -343,9 +335,11 @@ "nixos-generators": { "inputs": { "nixlib": [ + "digga", "nixlib" ], "nixpkgs": [ + "digga", "blank" ] }, @@ -365,11 +359,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1625333638, - "narHash": "sha256-M6J9RN60XJyv6nUfDFCwnz5aVjhe8+GJnV8Q9VpdQQQ=", + "lastModified": 1627365147, + "narHash": "sha256-weGn8tUd8VP+YFCqYZ8fOV8OPJxrZLtna8YJKri0Zfk=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "41775780a0b6b32b3d32dcc32bb9bc6df809062d", + "rev": "615e23579fec9bf0753fd72a8a447d9fb847c58f", "type": "github" }, "original": { @@ -380,11 +374,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1620340338, - "narHash": "sha256-Op/4K0+Z9Sp5jtFH0s/zMM4H7VFZxrekcAmjQ6JpQ4w=", + "lastModified": 1626556499, + "narHash": "sha256-c2ueMT7fi/yvCNq3nGLEC2v5GklS7eHpB1240LRSW9Y=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "63586475587d7e0e078291ad4b49b6f6a6885100", + "rev": "b59c06dc92f8d03660eb4155754d93a6c34cda83", "type": "github" }, "original": { @@ -416,7 +410,7 @@ ], "flake-utils": [ "digga", - "utils", + "flake-utils-plus", "flake-utils" ], "nixpkgs": [ @@ -424,11 +418,11 @@ ] }, "locked": { - "lastModified": 1626443440, - "narHash": "sha256-9xDWqVcLxAiRC/g/JnSfsj+s/Ont0fZjczAH9pqqBdg=", + "lastModified": 1627459777, + "narHash": "sha256-WHEAMMGG4hCJHLsk1k6BeHXOdI+HtG8wxLghVDp7h9Y=", "owner": "berberman", "repo": "nvfetcher", - "rev": "ba3366421ff66a06f4176780dff5e8373512bfba", + "rev": "f8c69f30993d69996236d4f1720794684aa5838c", "type": "github" }, "original": { @@ -437,22 +431,6 @@ "type": "github" } }, - "pre-commit-hooks-nix": { - "flake": false, - "locked": { - "lastModified": 1622650193, - "narHash": "sha256-qSzUpJDv04ajS9FXoCq6NjVF3qOt9IiGIiGh0P8amyw=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "0398f0649e0a741660ac5e8216760bae5cc78579", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, "root": { "inputs": { "agenix": "agenix", @@ -461,7 +439,6 @@ "blank" ], "bud": "bud", - "ci-agent": "ci-agent", "darwin": "darwin", "deploy": [ "digga", @@ -472,6 +449,10 @@ "digga", "flake-utils" ], + "flake-utils-plus": [ + "digga", + "flake-utils-plus" + ], "home": "home", "latest": "latest", "naersk": "naersk_2", @@ -486,32 +467,7 @@ "nixos" ], "nur": "nur", - "nvfetcher": "nvfetcher", - "utils": [ - "digga", - "utils" - ] - } - }, - "utils": { - "inputs": { - "flake-utils": [ - "flake-utils" - ] - }, - "locked": { - "lastModified": 1626288344, - "narHash": "sha256-TioHDqWJkw37jjx4DVrH6LCzwrUfAqXbWl4rKR91fpA=", - "owner": "gytis-ivaskevicius", - "repo": "flake-utils-plus", - "rev": "5c6ee69f6957afc2fe22c094717d6d78516418b5", - "type": "github" - }, - "original": { - "owner": "gytis-ivaskevicius", - "ref": "staging", - "repo": "flake-utils-plus", - "type": "github" + "nvfetcher": "nvfetcher" } } }, diff --git a/flake.nix b/flake.nix index 54b56cbf..ee7d7792 100644 --- a/flake.nix +++ b/flake.nix @@ -10,7 +10,7 @@ nixos.url = "nixpkgs/release-21.05"; latest.url = "nixpkgs"; - digga.url = "github:divnix/digga/develop"; + digga.url = "github:divnix/digga"; digga.inputs.nixpkgs.follows = "nixos"; digga.inputs.nixlib.follows = "nixos"; digga.inputs.home-manager.follows = "home"; @@ -33,13 +33,7 @@ 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"; + nvfetcher.inputs.flake-utils.follows = "digga/flake-utils-plus/flake-utils"; naersk.url = "github:nmattia/naersk"; naersk.inputs.nixpkgs.follows = "latest"; @@ -51,7 +45,7 @@ nixpkgs.follows = "nixos"; nixlib.follows = "digga/nixlib"; blank.follows = "digga/blank"; - utils.follows = "digga/utils"; + flake-utils-plus.follows = "digga/flake-utils-plus"; flake-utils.follows = "digga/flake-utils"; # end ANTI CORRUPTION LAYER @@ -64,7 +58,6 @@ , digga , bud , nixos - , ci-agent , home , nixos-hardware , nur @@ -74,9 +67,6 @@ , nix-dram , ... } @ inputs: - let - bud' = bud self; # rebind to access self.budModules - in digga.lib.mkFlake { inherit self inputs; @@ -85,7 +75,7 @@ channels = { nixos = { - imports = [ (digga.lib.importers.overlays ./overlays) ]; + imports = [ (digga.lib.importOverlays ./overlays) ]; overlays = [ digga.overlays.patchedNix nur.overlay @@ -114,25 +104,25 @@ hostDefaults = { system = "x86_64-linux"; channelName = "nixos"; - imports = [ (digga.lib.importers.modules ./modules) ]; + imports = [ (digga.lib.importModules ./modules) ]; externalModules = [ { lib.our = self.lib; } + digga.nixosModules.bootstrapIso digga.nixosModules.nixConfig - ci-agent.nixosModules.agent-profile home.nixosModules.home-manager agenix.nixosModules.age - (bud.nixosModules.bud bud') + bud.nixosModules.bud ]; }; - imports = [ (digga.lib.importers.hosts ./hosts) ]; + imports = [ (digga.lib.importHosts ./hosts) ]; hosts = { /* set host specific properties here */ NixOS = { }; }; importables = rec { - profiles = digga.lib.importers.rakeLeaves ./profiles // { - users = digga.lib.importers.rakeLeaves ./users; + profiles = digga.lib.rakeLeaves ./profiles // { + users = digga.lib.rakeLeaves ./users; }; suites = with profiles; rec { base = [ core users.nixos users.root ]; @@ -147,10 +137,10 @@ }; home = { - imports = [ (digga.lib.importers.modules ./users/modules) ]; + imports = [ (digga.lib.importModules ./users/modules) ]; externalModules = [ ]; importables = rec { - profiles = digga.lib.importers.rakeLeaves ./users/profiles; + profiles = digga.lib.rakeLeaves ./users/profiles; suites = with profiles; rec { base = [ direnv git ]; }; @@ -160,7 +150,7 @@ }; # digga.lib.importers.rakeLeaves ./users/hm; }; - devshell.modules = [ (import ./shell bud') ]; + devshell = ./shell; homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; diff --git a/modules/customBuilds.nix b/modules/customBuilds.nix deleted file mode 100644 index d7757c6b..00000000 --- a/modules/customBuilds.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ lib, pkgs, self, config, modules, channel, ... }: -{ - system.build = { - iso = (config.lib.digga.mkBuild - (config.lib.digga.modules.isoConfig { - inherit self; - fullHostConfig = config; - }) - ).config.system.build.isoImage; - }; -} diff --git a/shell/default.nix b/shell/default.nix index edad83c0..aef90a55 100644 --- a/shell/default.nix +++ b/shell/default.nix @@ -1,63 +1,10 @@ -bud: -{ pkgs, extraModulesPath, ... }: -let - - hooks = import ./hooks; - - pkgWithCategory = category: package: { inherit package category; }; - linter = pkgWithCategory "linter"; - docs = pkgWithCategory "docs"; - devos = pkgWithCategory "devos"; - -in +{ self, inputs, ... }: { - _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 + externalModules = with inputs; [ + bud.devshellModules.bud + ]; + modules = [ + ./devos.nix ]; - - 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/devos.nix b/shell/devos.nix new file mode 100644 index 00000000..83101d24 --- /dev/null +++ b/shell/devos.nix @@ -0,0 +1,61 @@ +{ 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 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) + + ; +}