Merge branch 'main' of github.com:ivabus/nix

This commit is contained in:
Ivan Bushchik 2023-08-09 15:12:25 +03:00
commit 07c32ad701
No known key found for this signature in database
GPG key ID: 2F16FBF3262E090C
13 changed files with 115 additions and 32 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
asahi*
flake.lock

View file

@ -1,8 +1,33 @@
# NixOS Configuration files. # NixOS Configuration files.
## TODO ## Deploying
- do something with dotfiles installation from [ivabus/dotfiles](https://github.com/ivabus/dotfiles) Setup disks, mount root to `/mnt` and `/boot` to `/mnt/boot` and run something like this
- install nixos on more machines
- write proper readme ```shell
- fix gtk theming issues git clone https://github.com/ivabus/nixos /mnt/etc/nixos
nixos-generate-config --show-hardware-config --root /mnt > /mnt/etc/nixos/machines/host/hardware.nix
nixos-install --flake path:.#host
```
## Rebuilding
```shell
nixos-rebuild switch --flake path:/etc/nixos
```
Apple Silicon hosts require additional `--impure` flag for firmware installation. (Firmware should be placed in /etc/nixos/asahi/firmware (ignored by git)).
### Hosts configured
- stella (Random Ryzen 3 3250U laptop)
- vetus (iMac 27" 2017)
- celerrime (MacBook Air M2)
## Dotfiles (from `ivabus/dotfiles`)
I'm installing my dotfiles using (with prepared script)
```shell
curl https://iva.bz/nix | sh
```

View file

@ -8,6 +8,9 @@
boot.plymouth.enable = true; boot.plymouth.enable = true;
hardware.bluetooth.enable = true;
services.blueman.enable = true;
services.tlp.enable = true; services.tlp.enable = true;
services.upower.enable = true; services.upower.enable = true;
} }

View file

@ -10,6 +10,22 @@
networking.nameservers = [ "1.1.1.1" "1.0.0.1" "8.8.8.8" ]; networking.nameservers = [ "1.1.1.1" "1.0.0.1" "8.8.8.8" ];
networking.enableIPv6 = true;
services.resolved.enable = true;
services.avahi = {
enable = true;
nssmdns = true;
publish = {
enable = true;
addresses = true;
domain = true;
hinfo = true;
userServices = true;
workstation = true;
};
};
services.timesyncd.enable = true; services.timesyncd.enable = true;
networking.timeServers = [ "ntp1.vniiftri.ru" "0.ru.pool.ntp.org" "0.pool.ntp.org" ]; networking.timeServers = [ "ntp1.vniiftri.ru" "0.ru.pool.ntp.org" "0.pool.ntp.org" ];
} }

View file

@ -5,7 +5,7 @@ let
in { in {
users.users.ivabus = { users.users.ivabus = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" ]; extraGroups = [ "wheel" "input" ];
uid = 1000; uid = 1000;
packages = with pkgs; [ packages = with pkgs; [
tree tree
@ -21,6 +21,10 @@ in {
# Stella # Stella
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDXWPxd1uVVxEARVezy0s0LZ9fC/Mif6s218oNWDyJNqZMnAiaMwwP/mGHqCy1OXFCb8/5Kv3AM+z6sxY4mIvyXhx3lPW841HoOlJxR+JQ50qgxon/oCXjKFVMZjFptRtexgQLhubhjyINagj7T/K6UjsfC9sIG5DUJdem0O8ZD/8EqvIrkeNGP52klJM3sR4vhXMNwOIPkukNOMq+OLXgAaCXRImc53N+Whi/tCaxxr/Nen5CVGo9raAekRKaiBLKvgboXYnxzNFxiecUe7mqPbyE2bcnJ+rDC7UlwrNYGyIQ/8POjQwbanFxT4UJhS5ib6/hSpia0eYaSiutBqU3fQcIXrmTQWOrGPdrUsLHw5xGMfwnPmoDFMYHdcchU0v6QijbrHrsqVV/bikWoQF4JT7PCwOejfVowOioPghvW2u34gTyMKPkueaMk0w8Jq45V0meneyN5SbobqZX3XFze4Uz3BN8nuiZB6pFRPv0eKLqEqX8+nST9uQDBkqKTvwE= ivabus@stella" "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDXWPxd1uVVxEARVezy0s0LZ9fC/Mif6s218oNWDyJNqZMnAiaMwwP/mGHqCy1OXFCb8/5Kv3AM+z6sxY4mIvyXhx3lPW841HoOlJxR+JQ50qgxon/oCXjKFVMZjFptRtexgQLhubhjyINagj7T/K6UjsfC9sIG5DUJdem0O8ZD/8EqvIrkeNGP52klJM3sR4vhXMNwOIPkukNOMq+OLXgAaCXRImc53N+Whi/tCaxxr/Nen5CVGo9raAekRKaiBLKvgboXYnxzNFxiecUe7mqPbyE2bcnJ+rDC7UlwrNYGyIQ/8POjQwbanFxT4UJhS5ib6/hSpia0eYaSiutBqU3fQcIXrmTQWOrGPdrUsLHw5xGMfwnPmoDFMYHdcchU0v6QijbrHrsqVV/bikWoQF4JT7PCwOejfVowOioPghvW2u34gTyMKPkueaMk0w8Jq45V0meneyN5SbobqZX3XFze4Uz3BN8nuiZB6pFRPv0eKLqEqX8+nST9uQDBkqKTvwE= ivabus@stella"
# Celerrime
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC/x2Xkj/w8Q6Ri+iP6b3dzY4KZ1q1RMqZmlFiiki/BuK+1Z+NMY6e6zgTJs1hSsd42XaTotHs75BcO13ou4Sa6p5Gmn+lC1tUWSEUhBoJimFmGp7E9wZjtzHIZyVRj7WMBUmbn4tgsnlGTS1rc2ODwBC7YLpqVzmgkLE3NyFXgSYhCRddvj16netrF6pQp+I/iTCblnhn8LOsnZMSU0aT92ybcLp6glwFh9DQNLyQ58V0fa2xzRN1iehu0TvX/M1aO91rseME+Ygz5m/JFc+G8onuUaDK/yezqkI9i6qxBHqu7+mBwUW5EIZLCwYd4JYDTGKrgVdO98acVcAjLv8rfKV8/SuODJ1fQafaz6C+O+3W9d5/L/HmCWunYKqDDNp14e8w0IHM2XC4mMYNABHisWkW6fMQ6mZxv2FuiYSITKdIUfFVbpdPOG7GF6jyDb/+LCR4vidNqXAU3ESGVOoyfDOvwm2lS5H7TVvBqEZUSjvIK8rqN5WRAdZ1iolADDoU= ivabus@celerrime"
]; ];
hashedPassword = secrets.hashed-password; hashedPassword = secrets.hashed-password;
}; };

View file

@ -26,7 +26,7 @@
./common/remote-access.nix ./common/remote-access.nix
./roles/graphical.nix ./roles/graphical.nix
./roles/latex.nix ./roles/latex.nix
#./roles/gaming.nix ./roles/gaming.nix
./roles/devel.nix ./roles/devel.nix
./roles/yggdrasil-client.nix ./roles/yggdrasil-client.nix
./machines/stella/configuration.nix ./machines/stella/configuration.nix
@ -68,9 +68,9 @@
./common/locale.nix ./common/locale.nix
./common/remote-access.nix ./common/remote-access.nix
./roles/graphical.nix ./roles/graphical.nix
#./roles/latex.nix ./roles/latex.nix
#./roles/gaming.nix #./roles/gaming.nix
#./roles/devel.nix ./roles/devel.nix
./roles/yggdrasil-client.nix ./roles/yggdrasil-client.nix
./machines/celerrime/configuration.nix ./machines/celerrime/configuration.nix
./machines/celerrime/hardware.nix ./machines/celerrime/hardware.nix

View file

@ -1,14 +1,16 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
imports = [ imports = [ ];
# Include the results of the hardware scan. networking.hostName = "celerrime";
./hardware-configuration.nix
# Include the necessary packages and configuration for Apple Silicon support.
<apple-silicon-support/apple-silicon-support>
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = false; boot.loader.efi.canTouchEfiVariables = false;
boot.kernelParams = [ "apple_dcp.show_notch=1" ];
hardware.asahi.peripheralFirmwareDirectory = ../../asahi/firmware;
hardware.asahi.addEdgeKernelConfig = true;
hardware.asahi.useExperimentalGPUDriver = true;
system.stateVersion = "23.05";
} }

View file

@ -0,0 +1,32 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "usb_storage" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/c313a438-700c-4d9c-9413-354ebfb010eb";
fsType = "btrfs";
};
boot.initrd.luks.devices."nixos-root".device = "/dev/disk/by-uuid/871dcf57-eee1-4dde-846d-e856c92f70c8";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/6CCA-1404";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/272341f1-b083-497e-b129-aef8732b5b50"; }
];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
}

View file

@ -10,6 +10,11 @@
services.xserver.videoDrivers=["amdgpu"]; services.xserver.videoDrivers=["amdgpu"];
boot.initrd.kernelModules=["amdgpu"]; boot.initrd.kernelModules=["amdgpu"];
powerManagement = {
enable = true;
cpuFreqGovernor = "performance";
};
system.stateVersion = "23.05"; system.stateVersion = "23.05";
} }

View file

@ -11,7 +11,6 @@
boot.kernelModules = [ "kvm-amd" "nct6775" ]; boot.kernelModules = [ "kvm-amd" "nct6775" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
environment.etc = { environment.etc = {
"sysconfig/lm_sensors".text = '' "sysconfig/lm_sensors".text = ''
HWMON_MODULES="lm75" HWMON_MODULES="lm75"
@ -34,10 +33,4 @@
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
services.tlp.settings = {
START_CHARGE_THRESH_BAT0 = 40;
STOP_CHARGE_THRESH_BAT0 = 80;
};
powerManagement.enable = true;
powerManagement.cpuFreqGovernor = "performance";
} }

View file

@ -7,6 +7,8 @@
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "vetus"; networking.hostName = "vetus";
system.stateVersion = "23.05"; system.stateVersion = "23.05";
} }

View file

@ -1,9 +1,8 @@
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
{ {
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
jetbrains.clion
rustc rustc
cargo cargo
rustup rustup