feat: rework shared/common lib
This commit is contained in:
parent
10ea13464f
commit
cf94e26b80
9 changed files with 70 additions and 50 deletions
|
@ -1,10 +1,9 @@
|
|||
{pkgs, ...}: let
|
||||
mainUser = "w";
|
||||
in {
|
||||
imports = [
|
||||
./hardware.nix
|
||||
../common/linux
|
||||
];
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [./hardware.nix];
|
||||
|
||||
boot = {
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
@ -31,13 +30,5 @@ in {
|
|||
};
|
||||
|
||||
virtualisation.docker.enable = true;
|
||||
|
||||
users.users."${mainUser}" = {
|
||||
extraGroups = ["wheel" "docker"];
|
||||
isNormalUser = true;
|
||||
openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILm0O46zW/XfVOSwz0okRWYeOAg+wCVkCtCAoVTpZsOh"];
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
system.stateVersion = "22.11";
|
||||
users.users."${config.dotfiles.username}".extraGroups = ["docker"];
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
# manipulate the global /etc/zshenv for PATH, etc.
|
||||
programs.zsh.enable = true;
|
||||
|
||||
# Used for backwards compatibility, please read the changelog before changing.
|
||||
# $ darwin-rebuild changelog
|
||||
system.stateVersion = 4;
|
||||
|
||||
security.pam.enableSudoTouchIdAuth = true;
|
||||
|
|
|
@ -36,4 +36,6 @@
|
|||
|
||||
programs.nix-ld.enable = true;
|
||||
programs.zsh.enable = true;
|
||||
|
||||
system.stateVersion = "22.11";
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
imports = [
|
||||
./nix.nix
|
||||
./podman.nix
|
||||
./user.nix
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
{pkgs, ...}: {
|
||||
imports = [
|
||||
./shared
|
||||
];
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
nix = {
|
||||
gc.automatic = true;
|
28
machines/common/shared/user.nix
Normal file
28
machines/common/shared/user.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
homeRoot =
|
||||
if pkgs.stdenv.isDarwin
|
||||
then "/Users"
|
||||
else if pkgs.stdenv.isLinux
|
||||
then "/home"
|
||||
else throw "Unsupported OS";
|
||||
in {
|
||||
users.users."${config.dotfiles.username}" =
|
||||
{
|
||||
home = "${homeRoot}/${config.dotfiles.username}";
|
||||
openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILm0O46zW/XfVOSwz0okRWYeOAg+wCVkCtCAoVTpZsOh"];
|
||||
shell = pkgs.zsh;
|
||||
}
|
||||
// (
|
||||
if pkgs.stdenv.isLinux
|
||||
then {
|
||||
isNormalUser = lib.mkIf pkgs.stdenv.isLinux true;
|
||||
extraGroups = ["wheel"];
|
||||
}
|
||||
else {}
|
||||
);
|
||||
}
|
|
@ -1,10 +1,9 @@
|
|||
{pkgs, ...}: let
|
||||
mainUser = "winston";
|
||||
in {
|
||||
imports = [
|
||||
./hardware.nix
|
||||
../common/linux
|
||||
];
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [./hardware.nix];
|
||||
|
||||
networking = {
|
||||
hostName = "futomaki";
|
||||
|
@ -19,19 +18,14 @@ in {
|
|||
blueman.enable = true;
|
||||
openssh.enable = true;
|
||||
pcscd.enable = true;
|
||||
transmission.enable = true;
|
||||
transmission.openFirewall = true;
|
||||
};
|
||||
|
||||
virtualisation.docker.enable = true;
|
||||
virtualisation.libvirtd.enable = true;
|
||||
|
||||
users.users."${mainUser}" = {
|
||||
extraGroups = ["docker" "libvirtd" "wheel" "transmission"];
|
||||
isNormalUser = true;
|
||||
openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILm0O46zW/XfVOSwz0okRWYeOAg+wCVkCtCAoVTpZsOh"];
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
system.stateVersion = "22.11";
|
||||
users.users."${config.dotfiles.username}".extraGroups = ["docker" "libvirtd" "transmission"];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
(discord.override {withOpenASAR = true;})
|
||||
|
@ -54,7 +48,4 @@ in {
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.transmission.enable = true;
|
||||
services.transmission.openFirewall = true;
|
||||
}
|
||||
|
|
|
@ -33,10 +33,6 @@
|
|||
};
|
||||
};
|
||||
});
|
||||
mkMerge = contents: {
|
||||
_type = "merge";
|
||||
inherit contents;
|
||||
};
|
||||
mkSystem = {
|
||||
host,
|
||||
system,
|
||||
|
@ -61,17 +57,36 @@
|
|||
else if isDarwin
|
||||
then "darwinModules"
|
||||
else throw "Unsupported system";
|
||||
hostPlatform =
|
||||
if isLinux
|
||||
then "linux"
|
||||
else if isDarwin
|
||||
then "darwin"
|
||||
else throw "Unsupported system";
|
||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||
inherit (pkgs.stdenv) isDarwin isLinux;
|
||||
in {
|
||||
${target}."${host}" = builder {
|
||||
inherit system;
|
||||
modules = with inputs;
|
||||
[./common ./${host} home-manager.${module}.home-manager]
|
||||
[
|
||||
{
|
||||
options.dotfiles.username = with pkgs.lib;
|
||||
mkOption {
|
||||
description = "Main user of this configuration.";
|
||||
type = types.str;
|
||||
default = "${username}";
|
||||
};
|
||||
}
|
||||
./common/shared
|
||||
./common/${hostPlatform}
|
||||
./${host}
|
||||
home-manager.${module}.home-manager
|
||||
]
|
||||
++ pkgs.lib.optionals isDarwin [nekowinston-nur.darwinModules.default]
|
||||
++ [(hmCommonConfig {inherit username;})]
|
||||
++ extraModules;
|
||||
};
|
||||
};
|
||||
mkSystems = systems: mkMerge (map mkSystem systems);
|
||||
mkSystems = systems: inputs.nixpkgs.lib.mkMerge (map mkSystem systems);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./brew.nix
|
||||
../common/darwin
|
||||
];
|
||||
imports = [./brew.nix];
|
||||
|
||||
users.users.winston.home = "/Users/winston";
|
||||
networking.computerName = "sashimi";
|
||||
networking.hostName = "sashimi";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue