mirror of
https://github.com/snowfallorg/nix-software-center.git
synced 2024-10-26 23:19:24 +03:00
Add modules
This commit is contained in:
parent
2a1d72434b
commit
5e40ef349d
@ -5,6 +5,10 @@
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, utils }:
|
||||
{
|
||||
nixosModules.nix-software-center = import ./modules/default.nix;
|
||||
nixosModules.default = self.nixosModules.nix-software-center;
|
||||
} //
|
||||
utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
|
34
modules/default.nix
Normal file
34
modules/default.nix
Normal file
@ -0,0 +1,34 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.nix-software-center;
|
||||
jsonFormat = pkgs.formats.json { };
|
||||
in
|
||||
{
|
||||
options = {
|
||||
programs.nix-software-center = {
|
||||
systemconfig = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
example = literalExpression ''"/etc/nixos/configuration.nix"'';
|
||||
description = ''Where Nix Software Center looks for your system configuration.'';
|
||||
};
|
||||
flake = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
example = literalExpression ''"/etc/nixos/flake.nix"'';
|
||||
description = ''Where Nix Software Center looks for your system flake file.'';
|
||||
};
|
||||
flakearg = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
example = literalExpression ''user'';
|
||||
description = ''The flake argument to use when rebuilding the system. `nixos-rebuild switch --flake $\{programs.nix-software-center.flake}#$\{programs.nix-software-center.flakearg}`'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.systemconfig != null || cfg.flake != null || cfg.flakearg != null) {
|
||||
environment.etc."nix-software-center/config.json".source = jsonFormat.generate "config.json" cfg;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user