Add configurable stream-tools option

This commit is contained in:
Andreas Schaafsma 2024-11-05 13:51:12 +01:00
parent 9dab2276d6
commit d2dceba0e9
5 changed files with 129 additions and 24 deletions

41
flake.lock generated
View File

@ -87,11 +87,29 @@
"type": "github" "type": "github"
} }
}, },
"game-of-life": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1728511087,
"narHash": "sha256-CvO74jwMjUUPySy0QCt7sPImbxKlhWcSAet93Fkt6iU=",
"owner": "local-interloper",
"repo": "game-of-life",
"rev": "c39d37e394f5da79a6a7d198e1d7e505aa5298a7",
"type": "github"
},
"original": {
"owner": "local-interloper",
"repo": "game-of-life",
"type": "github"
}
},
"nixos-wsl": { "nixos-wsl": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs_2"
}, },
"locked": { "locked": {
"lastModified": 1726981058, "lastModified": 1726981058,
@ -109,6 +127,22 @@
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 1717179513,
"narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "63dacb46bf939521bdc93981b4cbb7ecb58427a0",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1726320982, "lastModified": 1726320982,
"narHash": "sha256-RuVXUwcYwaUeks6h3OLrEmg14z9aFXdWppTWPMTwdQw=", "narHash": "sha256-RuVXUwcYwaUeks6h3OLrEmg14z9aFXdWppTWPMTwdQw=",
@ -124,7 +158,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1728241625, "lastModified": 1728241625,
"narHash": "sha256-yumd4fBc/hi8a9QgA9IT8vlQuLZ2oqhkJXHPKxH/tRw=", "narHash": "sha256-yumd4fBc/hi8a9QgA9IT8vlQuLZ2oqhkJXHPKxH/tRw=",
@ -142,8 +176,9 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"game-of-life": "game-of-life",
"nixos-wsl": "nixos-wsl", "nixos-wsl": "nixos-wsl",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_3",
"snowfall-lib": "snowfall-lib" "snowfall-lib": "snowfall-lib"
} }
}, },

View File

@ -10,32 +10,46 @@
url = "github:snowfallorg/lib"; url = "github:snowfallorg/lib";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
game-of-life.url = "github:local-interloper/game-of-life";
}; };
outputs = inputs: outputs = inputs: let
inputs.snowfall-lib.mkFlake { lib = inputs.snowfall-lib.mkLib {
inherit inputs;
src = ./.;
channels-config = {
allowUnfree = true;
allowUnfreePredicate = _: true;
permittedInsecurePackages = ["openssl-1.1.1w"];
};
# Configure Snowfall Lib, all of these settings are optional.
snowfall = {
# Tell Snowfall Lib to look in the `./nix/` directory for your
# Nix files.
root = ./.;
# Choose a namespace to use for your flake's packages, library,
# and overlays.
namespace = "my-namespace";
# Add flake metadata that can be processed by tools like Snowfall Frost.
meta = {
# A slug to use in documentation when displaying things like file paths.
name = "nixos-config-hionv";
# A title to show for your flake, typically the name.
title = "Hion's Personal NixOS Config";
};
};
};
in
lib.mkFlake {
inherit inputs; inherit inputs;
src = ./.; src = ./.;
# Configure Snowfall Lib, all of these settings are optional.
snowfall = {
# Tell Snowfall Lib to look in the `./nix/` directory for your
# Nix files.
root = ./.;
# Choose a namespace to use for your flake's packages, library,
# and overlays.
namespace = "my-namespace";
# Add flake metadata that can be processed by tools like Snowfall Frost.
meta = {
# A slug to use in documentation when displaying things like file paths.
name = "nixos-config-hionv";
# A title to show for your flake, typically the name.
title = "Hion's Personal NixOS Config";
};
};
systems.modules.nixos = with inputs; [ systems.modules.nixos = with inputs; [
# my-input.nixosModules.my-module # my-input.nixosModules.my-module

32
lib/default.nix Normal file
View File

@ -0,0 +1,32 @@
{lib, ...}: let
inherit (lib) mkOption strings;
inherit (lib.attrsets) filterAttrs mapAttrsToList;
inherit (lib.types) bool;
in rec {
disabled = {enable = false;};
enabled = {enable = true;};
ifThenElse = cond: t: f:
if cond
then t
else f;
mkOpt = type: default: description:
mkOption {inherit type default description;};
mkOpt' = type: default: mkOpt type default null;
mkBoolOpt = mkOpt bool;
mkBoolOpt' = mkOpt' bool;
mkPxeMenu = args:
''
UI menu.c32
TIMEOUT 300
''
+ strings.concatStringsSep "\n" (mapAttrsToList
(
name: value: ''
LABEL ${name}
MENU LABEL ${value.content.label}
KERNEL ${value.content.kernel}
append ${value.content.append}
''
)
(filterAttrs (_: v: v.condition) args));
}

View File

@ -0,0 +1,21 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib.my-namespace) mkEnableOption mkIf;
cfg = config.my-namespace.home.stream-tools;
in {
options.my-namespace.home.stream-tools = {
enable = mkEnableOption "Enable the Stream Machine Tools";
};
config = mkIf cfg.enable {
home = {
packages = with pkgs; [
obs-studio
];
};
};
}

View File

@ -49,9 +49,12 @@ in
soundwireserver soundwireserver
vscode vscode
spotify spotify
appimage-run
inputs.game-of-life.packages.x86_64-linux.default
# thunderbird # thunderbird
]; ];
}; };
lib.my-namespace.home.stream-tools.enable = true;
# Open ports in the firewall. # Open ports in the firewall.