refactor(flake): move some code out of flake.in.nix
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-07-21 17:12:26 -04:00
parent b3b65c1bd9
commit c701e335d1
39 changed files with 54 additions and 42 deletions

12
apps/default.nix Normal file
View file

@ -0,0 +1,12 @@
{
inputs,
pkgs,
...
}: let
mkApp = file: {
program = pkgs.callPackage file ({} // inputs);
type = "app";
};
in {
updateFlake = mkApp ./update;
}

View file

@ -53,7 +53,7 @@
perSystem = attrs:
nixpkgs.lib.genAttrs supportedSystems (system:
attrs system (mkPkgs system nixpkgs));
attrs (mkPkgs system nixpkgs));
in {
nixosModules = {
adb = import ./modules/adb.nix;
@ -95,8 +95,7 @@
];
live-image = mkNixOS [
("${nixpkgs}/nixos/modules/installer/"
+ "cd-dvd/installation-cd-minimal.nix")
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
{home-manager.users.nixos.home.stateVersion = "24.05";}
{
vars = {
@ -107,33 +106,28 @@
];
};
nixOnDroidConfigurations.default = mkNixOnDroid [./devices/android];
nixOnDroidConfigurations.default =
mkNixOnDroid [./devices/android];
legacyPackages = perSystem (system: pkgs: let
mkScope = file:
pkgs.lib.recurseIntoAttrs
(pkgs.callPackage file ({inherit mkVersion;} // inputs));
in {
dracula = mkScope ./pkgs/dracula;
firefoxAddons = mkScope ./pkgs/firefox-addons;
mpvScripts = mkScope ./pkgs/mpv-scripts;
});
legacyPackages =
perSystem (pkgs:
import ./legacyPackages {inherit mkVersion pkgs inputs;});
packages =
perSystem (system: pkgs:
import ./pkgs ({inherit self system pkgs mkVersion;} // inputs));
perSystem (pkgs:
import ./packages {inherit self pkgs mkVersion inputs;});
devShells = perSystem (_: pkgs: {
apps =
perSystem (pkgs:
import ./apps {inherit inputs pkgs;});
devShells = perSystem (pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
alejandra
git
nix-output-monitor
(writeShellScriptBin "mkIso" (lib.concatStrings [
"nom build $(realpath /etc/nixos)#nixosConfigurations."
"live-image.config.system.build.isoImage"
]))
(writeShellScriptBin "mkIso" ''
isoConfig="nixosConfigurations.live-image.config.system.build.isoImage"
nom build $(realpath /etc/nixos)#$isoConfig
'')
];
};
@ -161,21 +155,11 @@
};
});
formatter = perSystem (_: pkgs: pkgs.alejandra);
# Scripts
apps = perSystem (system: pkgs: let
inherit (pkgs) lib callPackage;
in {
updateFlake = {
program = lib.getExe (callPackage ./apps/update ({} // inputs));
type = "app";
};
});
# For nix-fast-build
checks =
perSystem (system: pkgs:
import ./flake/ci.nix {inherit system pkgs self;});
perSystem (pkgs:
import ./flake/ci.nix {inherit pkgs self;});
formatter = perSystem (pkgs: pkgs.alejandra);
};
}

View file

@ -1,6 +1,5 @@
# CI: https://github.com/Mic92/dotfiles/blob/c2f538934d67417941f83d8bb65b8263c43d32ca/flake.nix#L168
{
system,
pkgs,
self,
}: let
@ -9,6 +8,6 @@
nixosMachines =
mapAttrs'
(name: config: nameValuePair "nixos-${name}" config.config.system.build.toplevel)
((filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations);
((filterAttrs (_: config: config.pkgs.system == pkgs.system)) self.nixosConfigurations);
in
nixosMachines

View file

@ -0,0 +1,16 @@
{
inputs,
mkVersion,
pkgs,
...
}: let
inherit (pkgs) lib;
mkScope = file:
lib.recurseIntoAttrs
(pkgs.callPackage file ({inherit mkVersion;} // inputs));
in {
dracula = mkScope ./dracula;
firefoxAddons = mkScope ./firefox-addons;
mpvScripts = mkScope ./mpv-scripts;
}

View file

@ -1,8 +1,9 @@
{
pkgs,
inputs,
mkVersion,
pkgs,
...
} @ inputs: {
}: {
coloryou = pkgs.callPackage ./coloryou {};
gpu-screen-recorder = pkgs.callPackage ./gpu-screen-recorder {