From 65205a2fb854793b0ba2ea171d59e3ecc4ff308a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Tue, 16 Jan 2024 22:39:29 +0100 Subject: [PATCH] nod: Flake test --- README.md | 1 - flake.nix | 27 ++++++++++++++++++++++++--- hm/rebuild/default.nix | 6 ++++++ nod/README.md | 16 ++++++++++++++++ nod/common/default.nix | 2 +- nod/default.nix | 1 + os/geoffrey.nix | 3 --- sprinkles/README.md | 1 - sprinkles/nod.nix | 6 ------ 9 files changed, 48 insertions(+), 15 deletions(-) create mode 100644 nod/README.md delete mode 100644 sprinkles/README.md delete mode 100644 sprinkles/nod.nix diff --git a/README.md b/README.md index 6088706..72bc1ae 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,6 @@ It is built on top of the Nix ecosystem ## Scripts They all have a `-h` flag. -Except `add_channels.sh`, which should be removed as soon as I migrate to Flakes. ## Extensions diff --git a/flake.nix b/flake.nix index 50c3ce0..2d6d706 100644 --- a/flake.nix +++ b/flake.nix @@ -9,6 +9,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; nixos-hardware.url = "nixos-hardware"; + # NOD + nix-on-droid = { + url = "github:nix-community/nix-on-droid"; # No 23.11 :( + inputs.nixpkgs.follows = "nixpkgs"; + }; # HM home-manager = { url = "home-manager/release-23.11"; @@ -30,13 +35,13 @@ nur.url = "github:nix-community/NUR"; }; - outputs = { self, nixpkgs, disko, nixos-hardware, home-manager, stylix, nixvim, nixgl, nur, ... }: + outputs = { self, nixpkgs, disko, nixos-hardware, nix-on-droid, home-manager, stylix, nixvim, nixgl, nur, ... }: let sharedOverlays = [ nixgl.overlay ]; lib = { - nixosSystem = { system, modules }: nixpkgs.lib.nixosSystem { + nixosSystem = { system, modules ? [ ] }: nixpkgs.lib.nixosSystem { inherit system; modules = modules ++ [ self.nixosModules.dotfiles @@ -46,7 +51,16 @@ } ]; }; - homeManagerConfiguration = { system, modules }: home-manager.lib.homeManagerConfiguration { + nixOnDroidConfiguration = { modules ? [ ] }: nix-on-droid.lib.nixOnDroidConfiguration { + modules = modules ++ [ + self.nixOnDroidModules.dotfiles + { + nixpkgs.overlays = sharedOverlays; + home-manager.sharedModules = [ self.homeManagerModules.dotfiles ]; + } + ]; + }; + homeManagerConfiguration = { system, modules ? [ ] }: home-manager.lib.homeManagerConfiguration { pkgs = import nixpkgs { inherit system; overlays = sharedOverlays; @@ -64,6 +78,12 @@ home-manager.nixosModules.home-manager ]; }; + nixOnDroidModules.dotfiles = { + imports = [ + ./nod + home-manager.nixosModules.home-manager + ]; + }; homeManagerModules.dotfiles = { imports = [ ./hm @@ -86,5 +106,6 @@ nixos-hardware.nixosModules.pine64-pinebook-pro ]; }; + nixOnDroidConfigurations.sprinkles = lib.nixOnDroidConfiguration { }; }; } diff --git a/hm/rebuild/default.nix b/hm/rebuild/default.nix index 70ab94f..d29d5f0 100644 --- a/hm/rebuild/default.nix +++ b/hm/rebuild/default.nix @@ -31,6 +31,12 @@ in ${ulf} "$hm_flake" home-manager "$verb" "$@" fi + nod_flake="${config.xdg.configHome}/nix-on-droid/flake.nix" + if [ -f "$nod_flake" ] + then + ${ulf} "$nod_flake" + nix-on-droid "$verb" --flake "$(dirname "$nod_flake")" "$@" + fi ''; }) ]; diff --git a/nod/README.md b/nod/README.md new file mode 100644 index 0000000..732deec --- /dev/null +++ b/nod/README.md @@ -0,0 +1,16 @@ + +# Flake example + +`~/.config/nix-on-droid/flake.nix` + +```nix +{ + description = "Nix-on-droid configuration for Sprinkles"; + + inputs.dotfiles.url = "git+file:../dotfiles"; + + outputs = { dotfiles, ... }: { + nixOnDroidConfigurations.default = dotfiles.nixOnDroidConfigurations.sprinkles; + }; +} +``` diff --git a/nod/common/default.nix b/nod/common/default.nix index 6b9d4e4..bd907f0 100644 --- a/nod/common/default.nix +++ b/nod/common/default.nix @@ -4,7 +4,7 @@ home-manager = { useGlobalPkgs = true; config = {...}: { - imports = [ ../../hm ]; + frogeye = config.frogeye; home.file = { ".ssh/authorized_keys" = { # TODO Make an option and reuse at other places diff --git a/nod/default.nix b/nod/default.nix index dbb001d..5eb8d06 100644 --- a/nod/default.nix +++ b/nod/default.nix @@ -1,6 +1,7 @@ { ... }: { imports = [ + ../options.nix ./common ]; } diff --git a/os/geoffrey.nix b/os/geoffrey.nix index 7a1e78b..df0159b 100644 --- a/os/geoffrey.nix +++ b/os/geoffrey.nix @@ -19,9 +19,6 @@ home-manager = { users.geoffrey = { pkgs, ... }: { - imports = [ - ../hm - ]; frogeye = config.frogeye; }; # Makes VMs able to re-run diff --git a/sprinkles/README.md b/sprinkles/README.md deleted file mode 100644 index 77f9aa2..0000000 --- a/sprinkles/README.md +++ /dev/null @@ -1 +0,0 @@ -FIXME Make this work with flakes diff --git a/sprinkles/nod.nix b/sprinkles/nod.nix deleted file mode 100644 index 98387b2..0000000 --- a/sprinkles/nod.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ ... }: -{ - imports = [ - ../nod - ]; -}