WIP: Switch to NixOS #5

Draft
FunctionalHacker wants to merge 1349 commits from nix into main
10 changed files with 149 additions and 163 deletions
Showing only changes of commit 53c956d53e - Show all commits

View file

@ -1,76 +1,76 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
imports = [ imports = [
./gpg.nix ./gpg.nix
./users/functionalhacker/configuration.nix ./users/functionalhacker/configuration.nix
./users/som/configuration.nix ./users/som/configuration.nix
]; ];
system.stateVersion = "24.05"; system.stateVersion = "24.05";
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
time.timeZone = "Europe/Helsinki"; time.timeZone = "Europe/Helsinki";
i18n = { i18n = {
defaultLocale = "en_US.UTF-8"; defaultLocale = "en_US.UTF-8";
extraLocaleSettings = { extraLocaleSettings = {
LC_ADDRESS = "fi_FI.UTF-8"; LC_ADDRESS = "fi_FI.UTF-8";
LC_IDENTIFICATION = "fi_FI.UTF-8"; LC_IDENTIFICATION = "fi_FI.UTF-8";
LC_MEASUREMENT = "fi_FI.UTF-8"; LC_MEASUREMENT = "fi_FI.UTF-8";
LC_MONETARY = "fi_FI.UTF-8"; LC_MONETARY = "fi_FI.UTF-8";
LC_NAME = "fi_FI.UTF-8"; LC_NAME = "fi_FI.UTF-8";
LC_NUMERIC = "fi_FI.UTF-8"; LC_NUMERIC = "fi_FI.UTF-8";
LC_PAPER = "fi_FI.UTF-8"; LC_PAPER = "fi_FI.UTF-8";
LC_TELEPHONE = "fi_FI.UTF-8"; LC_TELEPHONE = "fi_FI.UTF-8";
LC_TIME = "fi_FI.UTF-8"; LC_TIME = "fi_FI.UTF-8";
};
};
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
};
services = {
xserver = {
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
xkb = {
layout = "us";
variant = "";
}; };
}; };
boot = { pipewire = {
loader = { enable = true;
systemd-boot.enable = true; pulse.enable = true;
efi.canTouchEfiVariables = true; };
}; };
};
services = {
xserver = {
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
xkb = {
layout = "us";
variant = "";
};
};
pipewire = {
enable = true;
pulse.enable = true;
};
};
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
hardware.pulseaudio.enable = false; hardware.pulseaudio.enable = false;
security.rtkit.enable = true; security.rtkit.enable = true;
programs.firefox = { programs.firefox = {
enable = true; enable = true;
nativeMessagingHosts.packages = [ pkgs.browserpass ]; nativeMessagingHosts.packages = [ pkgs.browserpass ];
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
git git
gnumake gnumake
home-manager home-manager
neovim neovim
telegram-desktop telegram-desktop
usbutils usbutils
wl-clipboard wl-clipboard
]; ];
} }

View file

@ -1,34 +1,35 @@
{ {
description = "FunctionalHacker's NixOS config"; description = "FunctionalHacker's NixOS config";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
home-manager = { home-manager = {
url = "github:nix-community/home-manager/release-24.05"; url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, home-manager, ... }:
let
lib = nixpkgs.lib;
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
in
{
nixosConfigurations.Mirkwood = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./common.nix
./hosts/Mirkwood/configuration.nix
];
}; };
};
outputs = { nixpkgs, home-manager, ...}: homeConfigurations = {
let functionalhacker = home-manager.lib.homeManagerConfiguration {
lib = nixpkgs.lib; inherit pkgs;
system = "x86_64-linux"; modules = [ ./users/functionalhacker/home.nix ];
pkgs = import nixpkgs { inherit system; }; };
in {
nixosConfigurations.Mirkwood = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./common.nix
./hosts/Mirkwood/configuration.nix
];
};
homeConfigurations = {
functionalhacker = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ ./users/functionalhacker/home.nix ];
};
};
}; };
};
} }

36
gpg.nix
View file

@ -1,24 +1,24 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
programs = { programs = {
ssh.startAgent = false; ssh.startAgent = false;
gnupg.agent = { gnupg.agent = {
enable = true; enable = true;
enableSSHSupport = true; enableSSHSupport = true;
}; };
}; };
services = { services = {
pcscd.enable = true; pcscd.enable = true;
udev.packages = [ udev.packages = [
pkgs.yubikey-personalization pkgs.yubikey-personalization
]; ];
}; };
environment.shellInit = '' environment.shellInit = ''
gpg-connect-agent /bye gpg-connect-agent /bye
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
export MARKON_MUUTTUJA="test" export MARKON_MUUTTUJA="test"
''; '';
} }

View file

@ -1,21 +1,4 @@
{ {
"bash-language-server": "5.4.0", "nil": "2024-08-06",
"css-lsp": "4.10.0", "nixpkgs-fmt": "1.3.0"
"docker-compose-language-service": "0.2.0", }
"dockerfile-language-server": "0.13.0",
"eslint-lsp": "4.10.0",
"google-java-format": "v1.23.0",
"html-lsp": "4.10.0",
"java-debug-adapter": "0.58.0",
"jdtls": "v1.38.0",
"json-lsp": "4.10.0",
"lemminx": "0.27.1",
"lua-language-server": "3.10.5",
"prettier": "3.3.3",
"prettierd": "0.25.3",
"stylua": "v0.20.0",
"taplo": "0.9.3",
"tree-sitter-cli": "v0.22.6",
"typescript-language-server": "4.3.3",
"yaml-language-server": "1.15.0"
}

View file

@ -2,8 +2,8 @@
{ {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
../../wifi.nix ../../wifi.nix
]; ];
networking.hostName = "Mirkwood"; networking.hostName = "Mirkwood";

View file

@ -5,7 +5,8 @@
{ {
imports = imports =
[ (modulesPath + "/installer/scan/not-detected.nix") [
(modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_usb_sdmmc" ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_usb_sdmmc" ];
@ -14,21 +15,22 @@
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
{ device = "/dev/disk/by-uuid/fcb4b991-0704-45c0-9d31-bd858e1476aa"; {
device = "/dev/disk/by-uuid/fcb4b991-0704-45c0-9d31-bd858e1476aa";
fsType = "ext4"; fsType = "ext4";
}; };
boot.initrd.luks.devices."luks-2d20d058-3ea8-41cf-90fa-872f46960add".device = "/dev/disk/by-uuid/2d20d058-3ea8-41cf-90fa-872f46960add"; boot.initrd.luks.devices."luks-2d20d058-3ea8-41cf-90fa-872f46960add".device = "/dev/disk/by-uuid/2d20d058-3ea8-41cf-90fa-872f46960add";
fileSystems."/boot" = fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/8498-FFAF"; {
device = "/dev/disk/by-uuid/8498-FFAF";
fsType = "vfat"; fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ]; options = [ "fmask=0077" "dmask=0077" ];
}; };
swapDevices = swapDevices =
[ { device = "/dev/disk/by-uuid/dba8a94b-d7b6-4ac1-a0bb-82d6538ff331"; } [{ device = "/dev/disk/by-uuid/dba8a94b-d7b6-4ac1-a0bb-82d6538ff331"; }];
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View file

@ -2,8 +2,8 @@
{ {
users.users.functionalhacker = { users.users.functionalhacker = {
description = "Marko"; description = "Marko";
isNormalUser = true; isNormalUser = true;
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = [ "networkmanager" "wheel" ];
}; };
} }

View file

@ -1,29 +1,29 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
programs.neovim = { programs.neovim = {
enable = true; enable = true;
defaultEditor = true; defaultEditor = true;
}; };
home = { home = {
username = "functionalhacker"; username = "functionalhacker";
homeDirectory = "/home/functionalhacker"; homeDirectory = "/home/functionalhacker";
stateVersion = "24.05"; stateVersion = "24.05";
file.".config/nvim".source = file.".config/nvim".source =
config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/git/dotfiles/home/.config/nvim"; config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/git/dotfiles/home/.config/nvim";
packages = with pkgs; [ packages = with pkgs; [
cargo cargo
fzf fzf
gcc gcc
nerdfonts nerdfonts
nodejs nodejs
pass pass
tree-sitter tree-sitter
yarn yarn
zsh zsh
]; ];
}; };
} }

View file

@ -2,8 +2,8 @@
{ {
users.users.som = { users.users.som = {
description = "Som"; description = "Som";
isNormalUser = true; isNormalUser = true;
extraGroups = [ "networkmanager" ]; extraGroups = [ "networkmanager" ];
}; };
} }

View file

@ -1,8 +1,8 @@
{...}: { ... }:
{ {
networking = { networking = {
networkmanager.wifi.backend = "iwd"; networkmanager.wifi.backend = "iwd";
wireless.iwd.enable = true; wireless.iwd.enable = true;
}; };
} }