nod: Flake test

This commit is contained in:
Geoffrey Frogeye 2024-01-16 22:39:29 +01:00
parent 55641fe958
commit 65205a2fb8
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
9 changed files with 48 additions and 15 deletions

View file

@ -28,7 +28,6 @@ It is built on top of the Nix ecosystem
## Scripts ## Scripts
They all have a `-h` flag. They all have a `-h` flag.
Except `add_channels.sh`, which should be removed as soon as I migrate to Flakes.
## Extensions ## Extensions

View file

@ -9,6 +9,11 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nixos-hardware.url = "nixos-hardware"; nixos-hardware.url = "nixos-hardware";
# NOD
nix-on-droid = {
url = "github:nix-community/nix-on-droid"; # No 23.11 :(
inputs.nixpkgs.follows = "nixpkgs";
};
# HM # HM
home-manager = { home-manager = {
url = "home-manager/release-23.11"; url = "home-manager/release-23.11";
@ -30,13 +35,13 @@
nur.url = "github:nix-community/NUR"; 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 let
sharedOverlays = [ sharedOverlays = [
nixgl.overlay nixgl.overlay
]; ];
lib = { lib = {
nixosSystem = { system, modules }: nixpkgs.lib.nixosSystem { nixosSystem = { system, modules ? [ ] }: nixpkgs.lib.nixosSystem {
inherit system; inherit system;
modules = modules ++ [ modules = modules ++ [
self.nixosModules.dotfiles 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 { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = sharedOverlays; overlays = sharedOverlays;
@ -64,6 +78,12 @@
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
]; ];
}; };
nixOnDroidModules.dotfiles = {
imports = [
./nod
home-manager.nixosModules.home-manager
];
};
homeManagerModules.dotfiles = { homeManagerModules.dotfiles = {
imports = [ imports = [
./hm ./hm
@ -86,5 +106,6 @@
nixos-hardware.nixosModules.pine64-pinebook-pro nixos-hardware.nixosModules.pine64-pinebook-pro
]; ];
}; };
nixOnDroidConfigurations.sprinkles = lib.nixOnDroidConfiguration { };
}; };
} }

View file

@ -31,6 +31,12 @@ in
${ulf} "$hm_flake" ${ulf} "$hm_flake"
home-manager "$verb" "$@" home-manager "$verb" "$@"
fi 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
''; '';
}) })
]; ];

16
nod/README.md Normal file
View file

@ -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;
};
}
```

View file

@ -4,7 +4,7 @@
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
config = {...}: { config = {...}: {
imports = [ ../../hm ]; frogeye = config.frogeye;
home.file = { home.file = {
".ssh/authorized_keys" = { ".ssh/authorized_keys" = {
# TODO Make an option and reuse at other places # TODO Make an option and reuse at other places

View file

@ -1,6 +1,7 @@
{ ... }: { ... }:
{ {
imports = [ imports = [
../options.nix
./common ./common
]; ];
} }

View file

@ -19,9 +19,6 @@
home-manager = { home-manager = {
users.geoffrey = { pkgs, ... }: { users.geoffrey = { pkgs, ... }: {
imports = [
../hm
];
frogeye = config.frogeye; frogeye = config.frogeye;
}; };
# Makes VMs able to re-run # Makes VMs able to re-run

View file

@ -1 +0,0 @@
FIXME Make this work with flakes

View file

@ -1,6 +0,0 @@
{ ... }:
{
imports = [
../nod
];
}