Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9169630b43 |
@@ -36,16 +36,31 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs:
|
outputs =
|
||||||
|
inputs:
|
||||||
let
|
let
|
||||||
lib = inputs.nixpkgs.lib;
|
lib = inputs.nixpkgs.lib;
|
||||||
linuxSystems = [ "x86_64-linux" "aarch64-linux" ];
|
supportedSystems = [
|
||||||
supportedSystems = linuxSystems ++ [ "x86_64-darwin" "aarch64-darwin" ];
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
linuxSystems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
];
|
||||||
|
forEachSystem = lib.genAttrs;
|
||||||
overlays = import ./overlays { inherit inputs; };
|
overlays = import ./overlays { inherit inputs; };
|
||||||
mkPkgs = system:
|
mkPkgs =
|
||||||
|
system:
|
||||||
import inputs.nixpkgs {
|
import inputs.nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
inherit overlays;
|
overlays = overlays ++ [
|
||||||
|
(final: prev: {
|
||||||
|
custom = import ./packages { pkgs = final; };
|
||||||
|
})
|
||||||
|
];
|
||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
};
|
};
|
||||||
gen = import ./generator.nix { inherit inputs mkPkgs supportedSystems; };
|
gen = import ./generator.nix { inherit inputs mkPkgs supportedSystems; };
|
||||||
@@ -59,11 +74,37 @@
|
|||||||
&& builtins.pathExists (systemsDir + "/${name}/cfg.nix")
|
&& builtins.pathExists (systemsDir + "/${name}/cfg.nix")
|
||||||
) (builtins.readDir systemsDir)
|
) (builtins.readDir systemsDir)
|
||||||
);
|
);
|
||||||
hostsByType = systemType:
|
hostsByType =
|
||||||
lib.filter (host: ((import (systemsDir + "/${host}/cfg.nix")).syscfg.type or "nixos") == systemType) systemNames;
|
systemType:
|
||||||
generateHosts = systemType:
|
lib.filter (host: (import (systemsDir + "/${host}/cfg.nix")).syscfg.type == systemType) systemNames;
|
||||||
lib.genAttrs (hostsByType systemType) (host: gen.generate { inherit host; });
|
generateHosts =
|
||||||
in {
|
systemType: lib.genAttrs (hostsByType systemType) (host: gen.generate { inherit host; });
|
||||||
|
flattenPackages =
|
||||||
|
prefix: attrs:
|
||||||
|
lib.concatMapAttrs (
|
||||||
|
name: value:
|
||||||
|
let
|
||||||
|
packageName = lib.concatStringsSep "-" (prefix ++ [ name ]);
|
||||||
|
defaultPackageName = lib.concatStringsSep "-" prefix;
|
||||||
|
in
|
||||||
|
if lib.isDerivation value then
|
||||||
|
{
|
||||||
|
"${if name == "default" && prefix != [ ] then defaultPackageName else packageName}" = value;
|
||||||
|
}
|
||||||
|
else if lib.isAttrs value then
|
||||||
|
flattenPackages (if name == "default" then prefix else prefix ++ [ name ]) value
|
||||||
|
else
|
||||||
|
{ }
|
||||||
|
) attrs;
|
||||||
|
mkPackages =
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = mkPkgs system;
|
||||||
|
in
|
||||||
|
lib.optionalAttrs pkgs.stdenv.isLinux (flattenPackages [ ] pkgs.custom);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages = forEachSystem linuxSystems mkPackages;
|
||||||
devShells = import ./shells {
|
devShells = import ./shells {
|
||||||
inherit inputs mkPkgs;
|
inherit inputs mkPkgs;
|
||||||
supportedSystems = linuxSystems;
|
supportedSystems = linuxSystems;
|
||||||
|
|||||||
+55
-42
@@ -1,6 +1,12 @@
|
|||||||
{ inputs, mkPkgs, supportedSystems, ... }:
|
|
||||||
{
|
{
|
||||||
generate = { host }:
|
inputs,
|
||||||
|
mkPkgs,
|
||||||
|
supportedSystems,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
generate =
|
||||||
|
{ host }:
|
||||||
let
|
let
|
||||||
syscfg = import ./systems/${host}/cfg.nix;
|
syscfg = import ./systems/${host}/cfg.nix;
|
||||||
nameValuePair = name: value: { inherit name value; };
|
nameValuePair = name: value: { inherit name value; };
|
||||||
@@ -12,45 +18,18 @@
|
|||||||
home = "x86_64-linux";
|
home = "x86_64-linux";
|
||||||
}
|
}
|
||||||
.${systemType} or (throw "Unsupported system type: ${systemType}");
|
.${systemType} or (throw "Unsupported system type: ${systemType}");
|
||||||
requestedSystem = syscfg.syscfg.system or defaultSystem;
|
system = syscfg.syscfg.system or defaultSystem;
|
||||||
system =
|
checkedSystem =
|
||||||
if builtins.elem requestedSystem supportedSystems then
|
if builtins.elem system supportedSystems then
|
||||||
requestedSystem
|
system
|
||||||
else
|
else
|
||||||
throw "Unsupported system '${requestedSystem}' for host '${host}'";
|
throw "Unsupported system '${system}' for host '${host}'";
|
||||||
users = syscfg.syscfg.users or [ ];
|
pkgs = mkPkgs checkedSystem;
|
||||||
mkLinuxHomeImports =
|
|
||||||
userConfig:
|
|
||||||
[
|
|
||||||
./modules/shared/syscfg
|
|
||||||
./modules/shared/colors
|
|
||||||
./modules/home
|
|
||||||
syscfg
|
|
||||||
{ usercfg = userConfig; }
|
|
||||||
inputs.nix-colors.homeManagerModule
|
|
||||||
inputs.sops-nix.homeManagerModules.sops
|
|
||||||
];
|
|
||||||
mkDarwinHomeImports = [ inputs.nix-colors.homeManagerModule inputs.sops-nix.homeManagerModules.sops ];
|
|
||||||
mkHomeUsers = importsForUser:
|
|
||||||
builtins.listToAttrs (
|
|
||||||
map (userConfig: nameValuePair userConfig.username { imports = importsForUser userConfig; }) users
|
|
||||||
);
|
|
||||||
mkHomeManager = importsForUser: {
|
|
||||||
home-manager.useGlobalPkgs = true;
|
|
||||||
home-manager.useUserPackages = true;
|
|
||||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
|
||||||
home-manager.users = mkHomeUsers importsForUser;
|
|
||||||
};
|
|
||||||
defaultUser =
|
|
||||||
builtins.head (
|
|
||||||
builtins.filter (user: user.username == syscfg.syscfg.defaultUser) users
|
|
||||||
++ [ { username = syscfg.syscfg.defaultUser; } ]
|
|
||||||
);
|
|
||||||
in
|
in
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
"nixos" = inputs.nixpkgs.lib.nixosSystem {
|
"nixos" = inputs.nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
system = checkedSystem;
|
||||||
specialArgs = { inherit inputs; };
|
specialArgs = { inherit inputs; };
|
||||||
modules = [
|
modules = [
|
||||||
./modules/shared/syscfg
|
./modules/shared/syscfg
|
||||||
@@ -64,12 +43,32 @@
|
|||||||
inputs.nixos-wsl.nixosModules.wsl
|
inputs.nixos-wsl.nixosModules.wsl
|
||||||
inputs.vscode-server.nixosModules.default
|
inputs.vscode-server.nixosModules.default
|
||||||
|
|
||||||
(mkHomeManager mkLinuxHomeImports)
|
{
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||||
|
home-manager.users = builtins.listToAttrs (
|
||||||
|
map (
|
||||||
|
userConfig:
|
||||||
|
nameValuePair userConfig.username {
|
||||||
|
imports = [
|
||||||
|
./modules/shared/syscfg
|
||||||
|
./modules/shared/colors
|
||||||
|
./modules/home
|
||||||
|
syscfg
|
||||||
|
{ usercfg = userConfig; }
|
||||||
|
inputs.nix-colors.homeManagerModule
|
||||||
|
inputs.sops-nix.homeManagerModules.sops
|
||||||
|
];
|
||||||
|
}
|
||||||
|
) (syscfg.syscfg.users or [ ])
|
||||||
|
);
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
"macos" = inputs.darwin.lib.darwinSystem {
|
"macos" = inputs.darwin.lib.darwinSystem {
|
||||||
inherit system;
|
system = checkedSystem;
|
||||||
modules = [
|
modules = [
|
||||||
./modules/shared/syscfg
|
./modules/shared/syscfg
|
||||||
./modules/shared/sops
|
./modules/shared/sops
|
||||||
@@ -77,13 +76,27 @@
|
|||||||
./systems/${host}
|
./systems/${host}
|
||||||
inputs.sops-nix.darwinModules.sops
|
inputs.sops-nix.darwinModules.sops
|
||||||
inputs.home-manager.darwinModules.home-manager
|
inputs.home-manager.darwinModules.home-manager
|
||||||
(mkHomeManager (_: mkDarwinHomeImports))
|
{
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||||
|
home-manager.users = builtins.listToAttrs (
|
||||||
|
map (
|
||||||
|
userConfig:
|
||||||
|
nameValuePair userConfig.username {
|
||||||
|
imports = [
|
||||||
|
inputs.nix-colors.homeManagerModule
|
||||||
|
inputs.sops-nix.homeManagerModules.sops
|
||||||
|
];
|
||||||
|
}
|
||||||
|
) (syscfg.syscfg.users or [ ])
|
||||||
|
);
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
"home" = inputs.home-manager.lib.homeManagerConfiguration {
|
"home" = inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
pkgs = mkPkgs system;
|
inherit pkgs;
|
||||||
extraSpecialArgs = { inherit inputs; };
|
modules = [ ./modules/home ];
|
||||||
modules = mkLinuxHomeImports defaultUser;
|
|
||||||
};
|
};
|
||||||
_ = throw "Unsupported system";
|
_ = throw "Unsupported system";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
{ lib, config, pkgs, ... }: {
|
{ lib, config, ... }: {
|
||||||
|
|
||||||
#environment.sessionVariables.SOPS_AGE_KEY_FILE = keyFilePath;
|
#environment.sessionVariables.SOPS_AGE_KEY_FILE = keyFilePath;
|
||||||
systemd.user.startServices = lib.mkIf pkgs.stdenv.isLinux "sd-switch";
|
systemd.user.startServices = "sd-switch";
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
username = "${config.usercfg.username}";
|
username = "${config.usercfg.username}";
|
||||||
homeDirectory =
|
homeDirectory = "/home/${config.usercfg.username}";
|
||||||
if pkgs.stdenv.isDarwin then
|
|
||||||
"/Users/${config.usercfg.username}"
|
|
||||||
else
|
|
||||||
"/home/${config.usercfg.username}";
|
|
||||||
|
|
||||||
stateVersion = "26.05";
|
stateVersion = "26.05";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,8 +3,12 @@
|
|||||||
permittedInsecurePackages = [ ];
|
permittedInsecurePackages = [ ];
|
||||||
allowUnfree = true;
|
allowUnfree = true;
|
||||||
android_sdk.accept_license = true;
|
android_sdk.accept_license = true;
|
||||||
|
packageOverrides = pkgs: rec {
|
||||||
|
custom = import ../../../../packages { inherit pkgs; };
|
||||||
};
|
};
|
||||||
nixpkgs.overlays = import ../../../../overlays { inherit inputs; };
|
|
||||||
|
};
|
||||||
|
nixpkgs.overlays = import ../../../../overlays { inherit inputs pkgs; };
|
||||||
nix = {
|
nix = {
|
||||||
package = pkgs.nixVersions.stable;
|
package = pkgs.nixVersions.stable;
|
||||||
extraOptions = ''
|
extraOptions = ''
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
{ name, ... }:
|
|
||||||
throw "Container app `${name}` is not implemented yet."
|
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
{ name, ... }:
|
{...}:{
|
||||||
throw "Container app `${name}` is not implemented yet."
|
|
||||||
|
}
|
||||||
@@ -16,9 +16,7 @@ let
|
|||||||
basePathConfigs =
|
basePathConfigs =
|
||||||
lib.mapAttrsToList (_: cfg: cfg) (lib.filterAttrs (name: _: name != "config" && name != "data") serverCfg.path);
|
lib.mapAttrsToList (_: cfg: cfg) (lib.filterAttrs (name: _: name != "config" && name != "data") serverCfg.path);
|
||||||
runtimePathConfigs = concatRuntimeLists "paths";
|
runtimePathConfigs = concatRuntimeLists "paths";
|
||||||
allSetupConfigs = builtins.filter
|
allSetupConfigs = map (app: ({ name = app.name; envFile = ""; } // app.runtime.setup)) appsList;
|
||||||
(setup: setup.script != null)
|
|
||||||
(map (app: ({ name = app.name; envFile = [ ]; } // app.runtime.setup)) appsList);
|
|
||||||
allCronsConfigs = concatRuntimeLists "cron";
|
allCronsConfigs = concatRuntimeLists "cron";
|
||||||
allVMConfigs = builtins.filter (app: app.runtime.vm != null) appsList;
|
allVMConfigs = builtins.filter (app: app.runtime.vm != null) appsList;
|
||||||
mkPathSetup = cfg:
|
mkPathSetup = cfg:
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
{ lib, ... }:
|
{ inputs, lib, ... }:
|
||||||
let
|
let
|
||||||
systemsDir = ../../../systems;
|
systemsDir = ../../../systems;
|
||||||
isIgnoredSystemDir = name: lib.hasPrefix "_" name || lib.hasPrefix "." name;
|
systemNames = lib.attrNames (lib.filterAttrs
|
||||||
systemNames = lib.attrNames (
|
(name: type: type == "directory" && builtins.pathExists (systemsDir + "/${name}/cfg.nix"))
|
||||||
lib.filterAttrs
|
(builtins.readDir systemsDir));
|
||||||
(name: type:
|
|
||||||
type == "directory"
|
|
||||||
&& !isIgnoredSystemDir name
|
|
||||||
&& builtins.pathExists (systemsDir + "/${name}/cfg.nix"))
|
|
||||||
(builtins.readDir systemsDir)
|
|
||||||
);
|
|
||||||
in with lib; {
|
in with lib; {
|
||||||
options.usercfg = import ./user.nix {inherit lib;};
|
options.usercfg = import ./user.nix {inherit lib;};
|
||||||
options.syscfg = {
|
options.syscfg = {
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ with lib; {
|
|||||||
domain = mkOption { type = types.str; default = ""; };
|
domain = mkOption { type = types.str; default = ""; };
|
||||||
port = mkOption { type = types.str; default = ""; };
|
port = mkOption { type = types.str; default = ""; };
|
||||||
noProxy = mkOption { type = types.str; default = ""; };
|
noProxy = mkOption { type = types.str; default = ""; };
|
||||||
cert = mkOption { type = types.nullOr types.path; default = null; };
|
cert = mkOption { type = types.path; default = null; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
#yarn-berry = import ./yarn-berry { inherit final prev; };
|
#yarn-berry = import ./yarn-berry { inherit final prev; };
|
||||||
#eww = import ./eww { inherit final prev; };
|
#eww = import ./eww { inherit final prev; };
|
||||||
# ags = import ./ags { inherit final prev; };
|
# ags = import ./ags { inherit final prev; };
|
||||||
custom = import ../packages { pkgs = final; };
|
|
||||||
wine = final.unstable.wineWow64Packages.unstableFull;
|
wine = final.unstable.wineWow64Packages.unstableFull;
|
||||||
unstable = import inputs.nixUnstable {
|
unstable = import inputs.nixUnstable {
|
||||||
system = final.stdenv.hostPlatform.system;
|
system = final.stdenv.hostPlatform.system;
|
||||||
|
|||||||
@@ -5,4 +5,12 @@
|
|||||||
repalette = pkgs.callPackage ./repalette { };
|
repalette = pkgs.callPackage ./repalette { };
|
||||||
|
|
||||||
vosk = pkgs.callPackage ./vosk { };
|
vosk = pkgs.callPackage ./vosk { };
|
||||||
|
|
||||||
|
pythonPackages = {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
nodePackages = {
|
||||||
|
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-4
@@ -1,8 +1,18 @@
|
|||||||
{ inputs, mkPkgs, supportedSystems, ... }:
|
{
|
||||||
inputs.nixpkgs.lib.genAttrs supportedSystems (
|
inputs,
|
||||||
|
mkPkgs,
|
||||||
|
supportedSystems,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
forEachSystem = inputs.nixpkgs.lib.genAttrs supportedSystems;
|
||||||
|
in
|
||||||
|
forEachSystem (
|
||||||
system:
|
system:
|
||||||
let pkgs = mkPkgs system;
|
let
|
||||||
in {
|
pkgs = mkPkgs system;
|
||||||
|
in
|
||||||
|
{
|
||||||
default = import ./devsh { inherit pkgs; };
|
default = import ./devsh { inherit pkgs; };
|
||||||
devsh = import ./devsh { inherit pkgs; };
|
devsh = import ./devsh { inherit pkgs; };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user