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"
}
},
"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": {
"locked": {
"lastModified": 1684049129,
@ -59,7 +39,6 @@
"root": {
"inputs": {
"disko": "disko",
"nixinate": "nixinate",
"nixpkgs": "nixpkgs"
}
}

View File

@ -1,11 +1,24 @@
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; };
inputs.nixinate = { url = "github:MatthewCroughan/nixinate"; inputs.nixpkgs.follows = "nixpkgs"; };
outputs = inputs: {
nixosConfigurations.tami-mac = import ./hosts/tami-mac inputs;
apps = inputs.nixinate.nixinate.x86_64-linux inputs.self;
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; };
};
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;
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.nixpkgs.lib.nixosSystem {
let inherit (inputs.nixpkgs) lib; in
lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./configuration.nix
./hardware-configuration.nix
modules = builtins.filter (x: lib.hasSuffix ".nix" x && baseNameOf x != "default.nix") (lib.filesystem.listFilesRecursive ./.) ++ [
inputs.disko.nixosModules.disko
"${inputs.self}/profiles/nix-nixpkgs.nix"
"${inputs.self}/profiles/ssh.nix"
{
_module.args.nixinate = {
host = "tami-mac";
sshUser = "tami";
buildOn = "remote";
substituteOnTarget = true;
hermetic = false;
};
}
{ system.stateVersion = "23.05"; }
];
}

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
device = "/dev/sda";
in
{
imports = [ inputs.disko.nixosModules.disko ];
disko.devices = {
disk.${baseNameOf 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;
};
};
}