treewide: refactor

This commit is contained in:
Ilan Joselevich 2023-05-17 00:15:23 +03:00
parent 7ddc09d5da
commit 4717c7fb01
No known key found for this signature in database
11 changed files with 94 additions and 110 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*result*

View File

@ -20,26 +20,6 @@
"type": "github" "type": "github"
} }
}, },
"nixinate": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1671116920,
"narHash": "sha256-QmDGsUUmAGn77UTR7eQJmebl8f3IIUCtmbbAdJqKA3s=",
"owner": "MatthewCroughan",
"repo": "nixinate",
"rev": "b4d17b8e2a4abc47e93e1a1c466e0286a63640d8",
"type": "github"
},
"original": {
"owner": "MatthewCroughan",
"repo": "nixinate",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1684049129, "lastModified": 1684049129,
@ -59,7 +39,6 @@
"root": { "root": {
"inputs": { "inputs": {
"disko": "disko", "disko": "disko",
"nixinate": "nixinate",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
} }

View File

@ -1,11 +1,24 @@
{ {
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs = {
inputs.disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; }; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.nixinate = { url = "github:MatthewCroughan/nixinate"; inputs.nixpkgs.follows = "nixpkgs"; }; disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; };
};
outputs = inputs: { outputs = inputs:
let
system = "x86_64-linux";
pkgs = inputs.nixpkgs.legacyPackages.${system};
inherit (inputs.nixpkgs) lib;
in
{
nixosConfigurations.tami-mac = import ./hosts/tami-mac inputs; nixosConfigurations.tami-mac = import ./hosts/tami-mac inputs;
apps = inputs.nixinate.nixinate.x86_64-linux inputs.self; apps.${system} = lib.mapAttrs' (n: v: lib.nameValuePair ("deploy-${n}") v) (lib.genAttrs (lib.attrNames inputs.self.nixosConfigurations) (host: {
type = "app";
program = toString (pkgs.writeShellScript "deploy-${host}" ''
${lib.getExe pkgs.nixos-rebuild} switch --fast --flake ${inputs.self}#${host} \
--build-host tami@${host} --target-host tami@${host}
'');
}));
}; };
} }

View File

@ -1,65 +0,0 @@
{ pkgs, ... }:
{
networking = {
hostName = "tami-mac";
networkmanager.enable = true;
};
time.timeZone = "Asia/Jerusalem";
services.pipewire = {
enable = true;
pulse.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
};
hardware.pulseaudio.enable = false;
sound.enable = false;
system.stateVersion = "23.05";
programs.vim.defaultEditor = true;
users = {
mutableUsers = false;
users."tami" = {
isNormalUser = true;
hashedPassword = "$y$j9T$BUWA7o2/xFFY6g/B9somr1$rveo/ttShW7jd835kf2pE9vAfDIXj/Hii3B5c9GyCjA";
openssh.authorizedKeys.keys = [
# Kranzes/Ilan
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIBF2qWuvMCuJMlc6+ehyU0V/asmfAlT5/GLhUQqbpQ/bAAAABHNzaDo="
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIEVpaQ0K0Fzz0Hu48pqKiI25lr9ASwXR1yzYbeErBX/2AAAABHNzaDo="
];
extraGroups = [ "wheel" "networkmanager" ];
uid = 1000;
packages = with pkgs; [
firefox
git
wget
];
};
};
services.xserver = {
enable = true;
desktopManager.plasma5.enable = true;
displayManager = {
defaultSession = "plasmawayland";
lightdm.enable = true;
autoLogin.user = "tami";
};
};
programs.dconf.enable = true;
programs.xwayland.enable = true;
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
programs.adb.enable = true;
}

View File

@ -1,21 +1,14 @@
inputs: inputs:
inputs.nixpkgs.lib.nixosSystem { let inherit (inputs.nixpkgs) lib; in
lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [ modules = builtins.filter (x: lib.hasSuffix ".nix" x && baseNameOf x != "default.nix") (lib.filesystem.listFilesRecursive ./.) ++ [
./configuration.nix inputs.disko.nixosModules.disko
./hardware-configuration.nix
"${inputs.self}/profiles/nix-nixpkgs.nix" "${inputs.self}/profiles/nix-nixpkgs.nix"
"${inputs.self}/profiles/ssh.nix" "${inputs.self}/profiles/ssh.nix"
{ { system.stateVersion = "23.05"; }
_module.args.nixinate = {
host = "tami-mac";
sshUser = "tami";
buildOn = "remote";
substituteOnTarget = true;
hermetic = false;
};
}
]; ];
} }

View File

@ -0,0 +1,21 @@
{
services.xserver = {
enable = true;
desktopManager.plasma5.enable = true;
displayManager = {
defaultSession = "plasmawayland";
lightdm.enable = true;
autoLogin.user = "tami";
};
};
programs.dconf.enable = true;
programs.xwayland.enable = true;
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
}

View File

@ -1,11 +1,9 @@
{ inputs, pkgs, ... }: { pkgs, ... }:
let let
device = "/dev/sda"; device = "/dev/sda";
in in
{ {
imports = [ inputs.disko.nixosModules.disko ];
disko.devices = { disko.devices = {
disk.${baseNameOf device} = { disk.${baseNameOf device} = {
inherit device; inherit device;

View File

@ -0,0 +1,8 @@
{
networking = {
hostName = "tami-mac";
networkmanager.enable = true;
};
time.timeZone = "Asia/Jerusalem";
}

View File

@ -0,0 +1,8 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
wget
tree
];
}

View File

@ -0,0 +1,8 @@
{
programs = {
vim.defaultEditor = true;
firefox.enable = true;
git.enable = true;
adb.enable = true;
};
}

20
hosts/tami-mac/users.nix Normal file
View File

@ -0,0 +1,20 @@
{ lib, config, ... }:
{
users = {
mutableUsers = false;
users."tami" = {
isNormalUser = true;
hashedPassword = "$y$j9T$BUWA7o2/xFFY6g/B9somr1$rveo/ttShW7jd835kf2pE9vAfDIXj/Hii3B5c9GyCjA";
openssh.authorizedKeys.keys = [
# Kranzes/Ilan
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIBF2qWuvMCuJMlc6+ehyU0V/asmfAlT5/GLhUQqbpQ/bAAAABHNzaDo="
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIEVpaQ0K0Fzz0Hu48pqKiI25lr9ASwXR1yzYbeErBX/2AAAABHNzaDo="
];
extraGroups = [ "wheel" ]
++ lib.optional config.networking.networkmanager.enable "networkmanager"
++ lib.optional config.programs.adb.enable "adbusers";
uid = 1000;
};
};
}