a lot more changes to get it to work on hpm

This commit is contained in:
Sebastian Moser
2023-10-31 16:14:10 +00:00
parent 197a40364c
commit 91f23c5632
24 changed files with 403 additions and 343 deletions

View File

@@ -1,12 +1,48 @@
{}: { inputs, self, secretsDir, specialArgs, ... }:
# config that i use on all my hosts # config that i use on all my hosts
{ {
imports = [
inputs.home-manager.nixosModules.home-manager
../mods/my-nixpkgs-overlay.nix
];
home-manager.extraSpecialArgs = specialArgs;
# set root user pwd
users.users.root.passwordFile = "${secretsDir}/main-root-pwd";
# Set your time zone. # Set your time zone.
time.timeZone = "Europe/Vienna"; time.timeZone = "Europe/Vienna";
users.mutableUsers = false;
# add mybin to path
environment.etc.profile.text = ''
export PATH=$PATH:${self}/mybin
'';
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
home-manager.backupFileExtension = "backup";
security.sudo.wheelNeedsPassword = false;
users.mutableUsers = false;
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
} }

View File

@@ -0,0 +1,87 @@
{ self, pkgs, ... }:
{
imports = [
../mods/battery_monitor.nix
];
modules.battery_monitor.enable = true;
# Enable the X11 windowing system.
services.xserver = {
enable = true;
displayManager = {
defaultSession = "none+xmonad";
sessionCommands = ''
xmobar ${self}/misc/xmobar.hs &
# aparently needed, so that xmonad works
sleep 2 && \
${pkgs.xorg.xmodmap}/bin/xmodmap \
-e "clear control" \
-e "clear mod1" \
-e "keycode 64 = Control_L" \
-e "keycode 37 = Alt_L" \
-e "add control = Control_L" \
-e "add mod1 = Alt_L" \
&
'';
};
displayManager.lightdm = {
enable = true;
greeters.enso = {
enable = true;
blur = true;
extraConfig = ''
default-wallpaper=/usr/share/streets_of_gruvbox.png
'';
};
};
layout = "at";
};
# xdg portals
xdg.portal = {
enable = true;
extraPortals = [
#pkgs.xdg-desktop-portal-gtk
#pkgs.xdg-desktop-portal-termfilechooser
(pkgs.callPackage ../mods/xdg-desktop-portal-termfilechooser/default.nix {})
];
};
# Configure keymap in X11
# services.xserver.xkbOptions = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
services.blueman.enable = true;
hardware.bluetooth.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
services.xserver.libinput.enable = true;
# xmonad
services.xserver.windowManager.xmonad = {
enable = true;
#config = builtins.toPath "${self}/misc/xmonad.hs";
config = builtins.readFile (self + /misc/xmonad.hs);
#config = "${confDir}/misc/xmo";
enableContribAndExtras = true;
extraPackages = hpkgs: [
hpkgs.xmobar
#hpkgs.xmonad-screenshot
];
ghcArgs = [
"-hidir /tmp" # place interface files in /tmp, otherwise ghc tries to write them to the nix store
"-odir /tmp" # place object files in /tmp, otherwise ghc tries to write them to the nix store
#"-i${xmonad-contexts}" # tell ghc to search in the respective nix store path for the module
];
};
}

View File

@@ -1,4 +1,4 @@
{}: { ... }:
# config that i use on all my hosts, that run native nixos # config that i use on all my hosts, that run native nixos
# excluding for example my phone phone # excluding for example my phone phone
@@ -12,6 +12,5 @@
#keyMap = "at"; #keyMap = "at";
useXkbConfig = true; # use xkbOptions in tty. useXkbConfig = true; # use xkbOptions in tty.
}; };
} }

View File

@@ -1,12 +0,0 @@
{ inputs, self, ... }:
{
home-manager.users.me = { ... }: {
imports = [
inputs.nix-doom-emacs.hmModule
];
programs.doom-emacs = {
enable = true;
doomPrivateDir = "${self}/common/programs/emacs";
};
};
}

View File

@@ -35,7 +35,7 @@
persistentDir = "/home/me/work/app-data"; persistentDir = "/home/me/work/app-data";
in in
{ {
nixosConfigurations = { nixosConfigurations = rec {
"c2vi-main" = nixpkgs.lib.nixosSystem { "c2vi-main" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
@@ -52,7 +52,7 @@
specialArgs = { inherit inputs confDir workDir secretsDir persistentDir self; }; specialArgs = { inherit inputs confDir workDir secretsDir persistentDir self; };
modules = [ modules = [
./hosts/main.nix ./hosts/hpm.nix
./hardware/hpm-laptop.nix ./hardware/hpm-laptop.nix
]; ];
}; };
@@ -67,6 +67,7 @@
}; };
packages.x86_64-linux = { packages.x86_64-linux = {
cbm = nixpkgs.x86_64.callPackage ./mods/cbm.nix { };
#default... TODO #default... TODO
}; };
}; };

11
hosts/hpm.nix Normal file
View File

@@ -0,0 +1,11 @@
{ inputs, ... }:
{
imports = [
../common/all.nix
../common/nixos.nix
../common/nixos-graphical.nix
../users/me/default.nix
];
}

View File

@@ -1,5 +1,5 @@
{ pkgs, lib, workDir, confDir, inputs, ... }: { pkgs, lib, workDir, self, secretsDir, ... }:
{ {
# https://bugzilla.kernel.org/show_bug.cgi?id=110941 # https://bugzilla.kernel.org/show_bug.cgi?id=110941
@@ -11,39 +11,83 @@
# fileSystems."/".options = [ "noatime" "nodiratime" "discard" ]; # fileSystems."/".options = [ "noatime" "nodiratime" "discard" ];
############################# BOOT #############################
# boot
imports = [ imports = [
../mods/battery_monitor.nix ../common/all.nix
../mods/my-nixpkgs-overlay.nix ../common/nixos.nix
inputs.home-manager.nixosModules.home-manager ../common/nixos-graphical.nix
../users/me/home.nix ../users/me/default.nix
]; ];
#home-manager.users.me = import ../users/me/home.nix;
############################# MISC ############################# networking.hostName = "c2vi-main"; # Define your hostname.
# misc
# some bind mounts
fileSystems."${workDir}/priv-share/things" = {
device = "${workDir}/things";
options = [ "bind" ];
};
fileSystems."${workDir}/things/htl" = {
device = "${workDir}/htl";
options = [ "bind" ];
};
fileSystems."${workDir}/things/diplomarbeit" = {
device = "${workDir}/diplomarbeit";
options = [ "bind" ];
};
# syncthing for main
services.syncthing = {
enable = true;
user = "me";
#dataDir = "/home/";
configDir = "/home/me/.config/syncthing";
extraFlags = ["-no-browser"];
openDefaultPorts = true;
overrideDevices = true; # overrides any devices added or deleted through the WebUI
overrideFolders = true; # overrides any folders added or deleted through the WebUI
devices = {
"seb-phone" = {
id = builtins.readFile "${secretsDir}/syncthing-id-phone";
#addresses = [ "tcp://192.168.200.24:22000" ];
};
"seb-tab" = {
id = builtins.readFile "${secretsDir}/syncthing-id-tab";
#addresses = [ "tcp://192.168.200.26:22000" ];
};
};
folders = {
"priv-share" = { # Name of folder in Syncthing, also the folder ID
path = "/home/me/work/priv-share"; # Which folder to add to Syncthing
#devices = [ "seb-phone" "seb-tab" ]; # Which devices to share the folder with
devices = [ "seb-phone" "seb-tab" ]; # Which devices to share the folder with
};
};
};
nixpkgs.config.permittedInsecurePackages = [ nixpkgs.config.permittedInsecurePackages = [
"electron-24.8.6" "electron-24.8.6"
]; ];
security.polkit.enable = true; security.polkit.enable = true;
networking.firewall.enable = true; networking.firewall.enable = true;
networking.firewall.allowPing = true; networking.firewall.allowPing = true;
services.samba.openFirewall = true; services.samba.openFirewall = true;
# samba # samba
services.samba-wsdd.enable = true; # make shares visible for windows 10 clients services.samba-wsdd.enable = true; # make shares visible for windows 10 clients
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
5357 # wsdd 5357 # wsdd
8888 # for general usage 8888 # for general usage
9999 # for general usage 9999 # for general usage
]; ];
networking.firewall.allowedUDPPorts = [ networking.firewall.allowedUDPPorts = [
3702 # wsdd 3702 # wsdd
]; ];
@@ -81,13 +125,10 @@
}; };
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nixpkgs.config.allowUnfree = true;
security.sudo.wheelNeedsPassword = false;
virtualisation.libvirtd.enable = true; virtualisation.libvirtd.enable = true;
programs.dconf.enable = true; programs.dconf.enable = true;
system.activationScripts.setupLibvirt = lib.stringAfter [ "var" ] '' system.activationScripts.setupLibvirt = lib.stringAfter [ "var" ] ''
ln -nsf ${workDir}/vm/libvirt/my-image-pool.xml /var/lib/libvirt/storage/my-image-pool.xml ln -nsf ${workDir}/vm/libvirt/my-image-pool.xml /var/lib/libvirt/storage/my-image-pool.xml
ln -nsf ${workDir}/vm/qemu/* /var/lib/libvirt/qemu/ ln -nsf ${workDir}/vm/qemu/* /var/lib/libvirt/qemu/
@@ -97,30 +138,8 @@
ln -nsf /run/current-system/sw/bin/bash /bin/bash ln -nsf /run/current-system/sw/bin/bash /bin/bash
''; '';
environment.etc.profile.text = ''
export PATH=$PATH:${confDir}/mybin
'';
modules.battery_monitor.enable = true;
xdg.portal = {
enable = true;
extraPortals = [
#pkgs.xdg-desktop-portal-gtk
#pkgs.xdg-desktop-portal-termfilechooser
(pkgs.callPackage ../mods/xdg-desktop-portal-termfilechooser/default.nix {})
];
};
networking.hostName = "c2vi-main"; # Define your hostname.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
services.blueman.enable = true;
hardware.bluetooth.enable = true;
################
# swap and hibernate # swap and hibernate
swapDevices = [ { device = "/dev/lvm0/swap"; } ]; swapDevices = [ { device = "/dev/lvm0/swap"; } ];
boot.resumeDevice = "/dev/lvm0/swap"; boot.resumeDevice = "/dev/lvm0/swap";
services.logind = { services.logind = {
@@ -136,69 +155,14 @@ export PATH=$PATH:${confDir}/mybin
HibernateMode=shutdown HibernateMode=shutdown
''; '';
# Enable the X11 windowing system.
services.xserver = {
enable = true;
displayManager = {
defaultSession = "none+xmonad";
sessionCommands = ''
xmobar ${confDir}/xmonad/xmobar.hs &
# aparently needed, so that xmonad works # List packages installed in system profile.
sleep 2 && \
${pkgs.xorg.xmodmap}/bin/xmodmap \
-e "clear control" \
-e "clear mod1" \
-e "keycode 64 = Control_L" \
-e "keycode 37 = Alt_L" \
-e "add control = Control_L" \
-e "add mod1 = Alt_L" \
&
'';
};
displayManager.lightdm = {
enable = true;
greeters.enso = {
enable = true;
blur = true;
extraConfig = ''
default-wallpaper=/usr/share/streets_of_gruvbox.png
'';
};
};
layout = "at";
};
# Configure keymap in X11
# services.xserver.xkbOptions = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
services.xserver.libinput.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! vim # Do not forget to add an editor to edit configuration.nix!
wget wget
xorg.xmodmap xorg.xmodmap
bluez bluez
]; ];
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
} }

19
mods/cbm.nix Normal file
View File

@@ -0,0 +1,19 @@
{ stdenv
, fetchFromGitHub
, libncurses
}:
stdenv.mkDerivation rec {
pname = "cbm";
version = "0.3.2";
src = fetchFromGitHub {
owner = "resurrecting-open-source-projects";
repo = "cbm";
tag = version;
};
nativeBuildInputs = [
libncurses
];
}

View File

@@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
home-manager.users.me.programs.alacritty = { programs.alacritty = {
enable = true; enable = true;
settings = { settings = {
font = { font = {

View File

@@ -1,6 +1,6 @@
{ persistentDir, confDir, ... }: { persistentDir, confDir, ... }:
{ {
home-manager.users.me.programs.bash = { programs.bash = {
enable = true; enable = true;
enableCompletion = true; enableCompletion = true;
@@ -259,13 +259,13 @@
function nixre(){ function nixre(){
if [ "$1" == "boot" ] if [ "$1" == "boot" ]
then then
nix build github:c2vi/nixos#nixosConfigurations.c2vi-main.config.system.build.toplevel --impure ''${@:2} nix build github:c2vi/nixos#nixosConfigurations.c2vi-main.config.system.build.toplevel --impure ''${@:2} \
sudo ./result/bin/switch-to-configuration boot && sudo ./result/bin/switch-to-configuration boot \
rm ./result && rm ./result
else else
nix build ~/work/config#nixosConfigurations.c2vi-main.config.system.build.toplevel --impure $@ nix build ~/work/config#nixosConfigurations.c2vi-main.config.system.build.toplevel --impure $@ \
sudo ./result/bin/switch-to-configuration switch && sudo ./result/bin/switch-to-configuration switch \
rm ./result && rm ./result
fi fi
} }

View File

@@ -0,0 +1,10 @@
{ inputs, self, ... }:
{
imports = [
inputs.nix-doom-emacs.hmModule
];
programs.doom-emacs = {
enable = true;
doomPrivateDir = "${self}/programs/emacs";
};
}

View File

View File

@@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
home-manager.users.me.programs.git = { programs.git = {
enable = true; enable = true;
userName = "Sebastian Moser"; userName = "Sebastian Moser";
userEmail = "me@c2vi.dev"; userEmail = "me@c2vi.dev";

View File

@@ -1,6 +1,6 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
home-manager.users.me.programs.lf = { programs.lf = {
package = pkgs.lf.overrideAttrs (final: prev: { package = pkgs.lf.overrideAttrs (final: prev: {
patches = (prev.patches or [ ]) ++ [ patches = (prev.patches or [ ]) ++ [
./lf-filter.patch ./lf-filter.patch

View File

@@ -1,6 +1,6 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
home-manager.users.me.programs.neovim = { programs.neovim = {
enable = true; enable = true;
withPython3 = true; withPython3 = true;
withNodeJs = true; withNodeJs = true;

View File

@@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
home-manager.users.me.programs.rofi = { programs.rofi = {
enable = true; enable = true;
theme = "Arc-Dark"; theme = "Arc-Dark";
extraConfig = { extraConfig = {

View File

@@ -1,6 +1,6 @@
{ secretsDir, ... }: { secretsDir, ... }:
{ {
home-manager.users.me.programs.ssh = { programs.ssh = {
enable = true; enable = true;
includes = [ "./current_rpi_config" ]; includes = [ "./current_rpi_config" ];
matchBlocks = { matchBlocks = {
@@ -39,7 +39,7 @@
}; };
}; };
home-manager.users.me.home.file.".ssh/rpi/local".text = '' home.file.".ssh/rpi/local".text = ''
Host config Host config
HostName 192.168.1.2 HostName 192.168.1.2
User config User config
@@ -74,7 +74,7 @@
IdentityFile ${secretsDir}/private-key-main IdentityFile ${secretsDir}/private-key-main
''; '';
home-manager.users.me.home.file.".ssh/rpi/remote".text = '' home.file.".ssh/rpi/remote".text = ''
Host config Host config
HostName sebastian.dns.army HostName sebastian.dns.army
User config User config
@@ -109,7 +109,7 @@
IdentityFile ${secretsDir}/private-key-main IdentityFile ${secretsDir}/private-key-main
''; '';
home-manager.users.me.home.file.".ssh/rpi/wstunnel".text = '' home.file.".ssh/rpi/wstunnel".text = ''
Host config Host config
HostName localhost HostName localhost
User config User config

View File

@@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
home-manager.users.me.programs.zathura = { programs.zathura = {
enable = true; enable = true;
options = { options = {
selection-clipboard = "clipboard"; selection-clipboard = "clipboard";

12
users/me/default.nix Normal file
View File

@@ -0,0 +1,12 @@
{ secretsDir, inputs, ... }:
{
users.users.me = {
isNormalUser = true;
passwordFile = "${secretsDir}/main-user-pwd";
extraGroups = [ "networkmanager" "wheel" "libvirtd" ]; # Enable sudo for the user.
};
#home-manager._module.args = { inherit inputs; };
home-manager.users.me = import ./home.nix;
}

View File

@@ -1,34 +1,28 @@
{ pkgs, workDir, confDir, secretsDir, inputs, ... }: { config, pkgs, workDir, confDir, secretsDir, inputs, ... }:
{ {
imports = [ # The home.stateVersion option does not have a default and must be set
../../common/programs/git.nix
../../common/programs/lf/default.nix
../../common/programs/alacritty.nix
../../common/programs/bash.nix
../../common/programs/emacs/default.nix
../../common/programs/rofi/default.nix
../../common/programs/zathura.nix
../../common/programs/ssh.nix
../../common/programs/neovim.nix
];
home-manager.backupFileExtension = "backup";
home-manager.users.me = { config, pkgs, ... }: {
/* The home.stateVersion option does not have a default and must be set */
home.stateVersion = "23.05"; home.stateVersion = "23.05";
imports = [ imports = [
inputs.nix-index-database.hmModules.nix-index inputs.nix-index-database.hmModules.nix-index
# all my programms with their own config
../../programs/git.nix
../../programs/lf/default.nix
../../programs/alacritty.nix
../../programs/bash.nix
../../programs/emacs/default.nix
../../programs/rofi/default.nix
../../programs/zathura.nix
../../programs/ssh.nix
../../programs/neovim.nix
]; ];
programs.nix-index.enable = false; programs.nix-index.enable = false;
programs.nix-index.enableBashIntegration = false; programs.nix-index.enableBashIntegration = false;
programs.nix-index.enableZshIntegration = false; programs.nix-index.enableZshIntegration = false;
#programs.command-not-found.enable = false;
gtk.cursorTheme = { gtk.cursorTheme = {
name = "Yaru"; name = "Yaru";
@@ -58,17 +52,7 @@
''; # documentation for this config file: https://svnbook.red-bean.com/en/1.7/svn.advanced.confarea.html ''; # documentation for this config file: https://svnbook.red-bean.com/en/1.7/svn.advanced.confarea.html
}; };
}; home.packages = with pkgs; [
fonts.fonts = with pkgs; [
hack-font
];
users.users.me = {
isNormalUser = true;
passwordFile = "${secretsDir}/main-user-pwd";
extraGroups = [ "networkmanager" "wheel" "libvirtd" ]; # Enable sudo for the user.
packages = with pkgs; [
neovim neovim
vim vim
obsidian obsidian
@@ -121,6 +105,19 @@
android-tools android-tools
moonlight-qt moonlight-qt
comma comma
delta
hack-font
inputs.firefox.packages.${pkgs.system}.firefox-nightly-bin
# python....
(python310.withPackages (p: with p; [
pandas
click
click-aliases
]))
(busybox.overrideAttrs (final: prev: { (busybox.overrideAttrs (final: prev: {
# get only nslookup from busybox # get only nslookup from busybox
# because the less would overwrite the actuall less and the busybox does not have -r # because the less would overwrite the actuall less and the busybox does not have -r
@@ -136,16 +133,6 @@
mv $out/busybox $out/bin/busybox mv $out/busybox $out/bin/busybox
''; '';
})) }))
delta
inputs.firefox.packages.${pkgs.system}.firefox-nightly-bin
# python....
(python310.withPackages (p: with p; [
pandas
click
click-aliases
]))
# base-devel # base-devel
gcc gcc
@@ -164,63 +151,9 @@
virt-manager virt-manager
freerdp freerdp
]; ];
};
# xmonad
services.xserver.windowManager.xmonad = {
enable = true;
config = ../../misc/xmonad.hs;
#config = "${confDir}/misc/xmo";
enableContribAndExtras = true;
extraPackages = hpkgs: [
hpkgs.xmobar
#hpkgs.xmonad-screenshot
];
ghcArgs = [
"-hidir /tmp" # place interface files in /tmp, otherwise ghc tries to write them to the nix store
"-odir /tmp" # place object files in /tmp, otherwise ghc tries to write them to the nix store
#"-i${xmonad-contexts}" # tell ghc to search in the respective nix store path for the module
];
};
services.syncthing = {
enable = true;
user = "me";
#dataDir = "/home/";
configDir = "/home/me/.config/syncthing";
extraFlags = ["-no-browser"];
openDefaultPorts = true;
overrideDevices = true; # overrides any devices added or deleted through the WebUI
overrideFolders = true; # overrides any folders added or deleted through the WebUI
devices = {
"seb-phone" = {
id = builtins.readFile "${secretsDir}/syncthing-id-phone";
#addresses = [ "tcp://192.168.200.24:22000" ];
};
"seb-tab" = {
id = builtins.readFile "${secretsDir}/syncthing-id-tab";
#addresses = [ "tcp://192.168.200.26:22000" ];
};
};
folders = {
"priv-share" = { # Name of folder in Syncthing, also the folder ID
path = "/home/me/work/priv-share"; # Which folder to add to Syncthing
#devices = [ "seb-phone" "seb-tab" ]; # Which devices to share the folder with
devices = [ "seb-phone" "seb-tab" ]; # Which devices to share the folder with
};
};
};
fileSystems."${workDir}/priv-share/things" = {
device = "${workDir}/things";
options = [ "bind" ];
};
fileSystems."${workDir}/things/htl" = {
device = "${workDir}/htl";
options = [ "bind" ];
};
fileSystems."${workDir}/things/diplomarbeit" = {
device = "${workDir}/diplomarbeit";
options = [ "bind" ];
};
} }
#fonts.fonts = with pkgs; [
#hack-font
#];