summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2022-12-27 01:19:08 -0600
committerAlejandro Soto <alejandro@34project.org>2022-12-27 01:19:08 -0600
commit61d433c8e7cc17d5b921329fca9baf7c3d528ade (patch)
tree1766c3dd3a9ff0dd06618adfa285d10951ceea2a
parent9d4a860360958a01490013b07c59083e9013cff4 (diff)
flake: rework flake inputs, overlays and platforms
Diffstat (limited to '')
-rw-r--r--config.nix3
-rw-r--r--flake.nix72
-rw-r--r--home/default.nix18
-rw-r--r--pkgs/default.nix45
-rw-r--r--sys/default.nix6
5 files changed, 71 insertions, 73 deletions
diff --git a/config.nix b/config.nix
deleted file mode 100644
index 8d78534..0000000
--- a/config.nix
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- android_sdk.accept_license = true;
-}
diff --git a/flake.nix b/flake.nix
index 1984f07..c1538c4 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,7 +1,7 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
- nixpkgsUnstable.url = "github:nixos/nixpkgs";
+ unstable.url = "github:nixos/nixpkgs";
home-manager = {
url = "github:nix-community/home-manager/release-22.11";
@@ -14,47 +14,69 @@
};
outputs =
- { self, nixpkgs, nixpkgsUnstable, home-manager
- , nur, impermanence, hm-isolation, ... }:
- with nixpkgs.lib; let
+ { self, nixpkgs, unstable, home-manager, nur, impermanence, hm-isolation, ... }: let
+ system = "x86_64-linux";
+
+ pkgs = pkgsNoLocal.extend self.overlays.default;
+ pkgsNoLocal = importPkgs nixpkgs;
+
+ importPkgs = flake: import flake {
+ inherit system;
+
+ config.android_sdk.accept_license = true;
+ overlays = [ nur.overlay ];
+ };
+
util = import ./util;
- inherit (util nixpkgs.lib) importAll;
+ inherit (util pkgs.lib) importAll;
- pkgSet = pkgs: import ./pkgs pkgs;
- in {
- packages."x86_64-linux" = pkgSet nixpkgs.legacyPackages."x86_64-linux";
+ local = import ./pkgs;
+ in with pkgs.lib; {
+ packages.${system} = local pkgs pkgsNoLocal;
- overlay = self: super: {
- local = pkgSet super;
- unstable = import nixpkgsUnstable { inherit (super) config system; };
+ overlays.default = final: prev: {
+ local = local final prev;
+ unstable = (importPkgs unstable).extend self.overlays.default;
};
nixosConfigurations = let
- hostConfig = host: (makeOverridable nixosSystem) {
- system = "x86_64-linux";
- modules = [ (import ./sys { inherit self impermanence; }) host ];
+ hostConfig = host: (makeOverridable nixpkgs.lib.nixosSystem) {
+ inherit pkgs system;
+
+ modules = [
+ ./sys
+ host
+ nixpkgs.nixosModules.notDetected
+ impermanence.nixosModule
+ ];
};
in mapAttrs (_: hostConfig) (importAll { root = ./sys/platform; });
homeConfigurations = let
- configuration = import ./home {
- inherit self nixpkgs nixpkgsUnstable nur hm-isolation;
+ registry = { ... }: {
+ config.nix.registry = {
+ "nixpkgs".flake = nixpkgs;
+ "unstable".flake = unstable;
+ "nur".flake = nur;
+ };
};
- username = "ale";
-
home = platform: home-manager.lib.homeManagerConfiguration {
- pkgs = import nixpkgs { system = "x86_64-linux"; };
- modules = [ configuration platform ];
+ inherit pkgs;
- # Optionally use extraSpecialArgs
- # to pass through arguments to home.nix
- extraSpecialArgs = {};
+ modules = [
+ ./home
+ platform
+ registry
+ hm-isolation.homeManagerModule
+ ];
};
- platformHome = name: platform: {
- name = "${username}@${name}";
+ platformHome = name: platform: let
value = home platform;
+ in {
+ inherit value;
+ name = "${value.config.home.username}@${name}";
};
in mapAttrs' platformHome (importAll { root = ./home/platform; });
};
diff --git a/home/default.nix b/home/default.nix
index d6e8a81..5d92b6e 100644
--- a/home/default.nix
+++ b/home/default.nix
@@ -1,8 +1,6 @@
-{ self, nixpkgs, nixpkgsUnstable, nur, hm-isolation }:
{ lib, config, pkgs, ... }:
with lib; {
imports = [
- hm-isolation.homeManagerModule
./desktop.nix
./environ.nix
./graphics.nix
@@ -15,17 +13,9 @@ with lib; {
};
config = {
- nixpkgs.overlays = [ nur.overlay self.overlay ];
-
- nix.registry = {
- "nixpkgs".flake = nixpkgs;
- "nixpkgsUnstable".flake = nixpkgsUnstable;
- "nur".flake = nur;
-
- "system".to = {
- type = "path";
- path = "/home/ale/nix";
- };
+ nix.registry."system".to = {
+ type = "path";
+ path = "${config.home.homeDirectory}/nix";
};
home = {
@@ -40,7 +30,7 @@ with lib; {
stateVersion = "21.11";
username = "ale";
- homeDirectory = "/home/ale";
+ homeDirectory = "/home/${config.home.username}";
sessionVariables = {
EDITOR = "nvim";
diff --git a/pkgs/default.nix b/pkgs/default.nix
index 21d9686..bed50a3 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -1,28 +1,23 @@
-pkgs:
-with pkgs.lib; let
- inherit (pkgs) buildEnv callPackage writeTextDir;
-
- combined = pkgs // { inherit local; };
-
- local = {
- btclone = callPackage ./btclone {};
- git-aliases = callPackage ./git-aliases.nix {};
- mssql-tools = callPackage ./mssql-tools.nix {};
- oregano = callPackage ./oregano {};
- rqlite = callPackage ./rqlite.nix {};
- rv8 = callPackage ./rv8.nix {};
- scripts = callPackage ./scripts {};
- tmux-lift = callPackage ./tmux-lift {};
+final: prev: let
+ inherit (final) callPackage fetchpatch;
+in {
+ btclone = callPackage ./btclone {};
+ git-aliases = callPackage ./git-aliases.nix {};
+ mssql-tools = callPackage ./mssql-tools.nix {};
+ oregano = callPackage ./oregano {};
+ rqlite = callPackage ./rqlite.nix {};
+ rv8 = callPackage ./rv8.nix {};
+ scripts = callPackage ./scripts {};
+ tmux-lift = callPackage ./tmux-lift {};
- st = pkgs.st.override {
- conf = import ./st.nix {};
+ st = prev.st.override {
+ conf = import ./st.nix {};
- patches = [
- (pkgs.fetchpatch {
- url = "https://st.suckless.org/patches/clipboard/st-clipboard-0.8.3.diff";
- sha256 = "cbb37675e9b4986836c19aadacc616a006df81c9bf394e9e3573e164fa1867cf";
- })
- ];
- };
+ patches = [
+ (fetchpatch {
+ url = "https://st.suckless.org/patches/clipboard/st-clipboard-0.8.3.diff";
+ sha256 = "cbb37675e9b4986836c19aadacc616a006df81c9bf394e9e3573e164fa1867cf";
+ })
+ ];
};
-in local
+}
diff --git a/sys/default.nix b/sys/default.nix
index ef60f43..47203f9 100644
--- a/sys/default.nix
+++ b/sys/default.nix
@@ -1,10 +1,6 @@
-{ self, impermanence }:
{ lib, config, pkgs, modulesPath, ... }:
with lib; {
imports = [
- "${modulesPath}/installer/scan/not-detected.nix"
- impermanence.nixosModule
-
./auth.nix
./boot.nix
./fs
@@ -14,8 +10,6 @@ with lib; {
];
config = {
- nixpkgs.overlays = [ self.overlay ];
-
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave