From d76d627eb123835e9cb57cf3bfc6a345b706f39b Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Thu, 3 Nov 2022 23:24:52 +0000 Subject: [PATCH] add nix-ld --- configuration.nix | 149 +++++++++++++++++++++++++++++++++++-- flake.lock | 18 +---- flake.nix | 41 +++++----- hardware-configuration.nix | 43 +++++++---- 4 files changed, 194 insertions(+), 57 deletions(-) diff --git a/configuration.nix b/configuration.nix index 0783363..8000c0a 100644 --- a/configuration.nix +++ b/configuration.nix @@ -2,22 +2,155 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ config, pkgs, lib, modulesPath, inputs, ... }: +{ lib, config, pkgs, ... }: { + imports = + [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + nix.package = pkgs.nixUnstable; + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; - imports = [ - ./hardware-configuration.nix - ]; + programs.nix-ld.enable = true; - services.sshd.enable = true; + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; - networking.hostName = "mysystem"; + # networking.hostName = "nixos"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - nixpkgs.overlays = [ inputs.nur.overlay ]; + # Set your time zone. + # time.timeZone = "Europe/Amsterdam"; + # Enable the X11 windowing system. + # services.xserver.enable = true; + programs.zsh.enable = true; + users.defaultUserShell = pkgs.zsh; + + # for compatibility add zsh to list of /etc/shells + environment.shells = with pkgs; [ zsh ]; + + # 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; + + # xservices + services.xserver.enable = true; + services.xserver.autorun = false; + services.xserver.displayManager.startx.enable = true; + services.xserver.windowManager.qtile.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.daylin = { + shell = pkgs.zsh; + isNormalUser = true; + extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + packages = with pkgs; [ + ]; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget environment.systemPackages = with pkgs; [ - pkgs.nur.repos.mic92.hello-nur + + fuse + zsh + + wget + + git + vim + # neovim + + nixpkgs-fmt + + autorandr + wezterm + eww + rofi + picom + dunst + (python3.withPackages (p: with p; [ tomli ])) + + ]; + + + ## make qtile's python handle the extra dependency + #nixpkgs.overlays = [ + #(self: super: { + #qtile = super.qtile.overrideAttrs(oldAttrs: { + #pythonPath = oldAttrs.pythonPath ++ (with self.python3Packages; [ + #tomli + #]); + #}); + # + #})]; + + + fonts.fonts = with pkgs; [ + (nerdfonts.override { fonts = [ "FiraCode" ]; }) + ]; + + + + + environment.variables = { + NIX_LD_LIBRARY_PATH = with pkgs; lib.makeLibraryPath [ + stdenv.cc.cc + openssl + + zlib # for delta + fuse # for libfuse/Neovim Appimage + ]; + NIX_LD = lib.fileContents "${pkgs.stdenv.cc}/nix-support/dynamic-linker"; + }; + + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # system.copySystemConfiguration = true; + + # 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 = "22.05"; # Did you read the comment? + } diff --git a/flake.lock b/flake.lock index b0475a3..e302a0b 100644 --- a/flake.lock +++ b/flake.lock @@ -16,25 +16,9 @@ "type": "github" } }, - "nur": { - "locked": { - "lastModified": 1604808696, - "narHash": "sha256-yJRRZEBzvfuDUMarWCbD6ehZd1u3rHqA9nK3OJOE30s=", - "owner": "nix-community", - "repo": "NUR", - "rev": "3189c40da661eefc0c604f7f50df4956cf542a25", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "NUR", - "type": "github" - } - }, "root": { "inputs": { - "nixpkgs": "nixpkgs", - "nur": "nur" + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index 2d50e30..545a6a8 100644 --- a/flake.nix +++ b/flake.nix @@ -1,27 +1,30 @@ - { description = "An example NixOS configuration"; inputs = { nixpkgs = { url = "github:nixos/nixpkgs/nixos-unstable"; }; - nur = { url = "github:nix-community/NUR"; }; - }; - - outputs = inputs: - /* ignore:: */ let ignoreme = ({config,lib,...}: with lib; { system.nixos.revision = mkForce null; system.nixos.versionSuffix = mkForce "pre-git"; }); in - { - nixosConfigurations = { - - mysystem = inputs.nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./configuration.nix - - /* ignore */ ignoreme # ignore this; don't include it; it is a small helper for this example - ]; - specialArgs = { inherit inputs; }; - }; + nix-ld = { + url = "github:Mic92/nix-ld"; + inputs.nixpkgs.follows = "nixpkgs"; }; }; -} + + outputs = inputs: + /* ignore:: */ + let ignoreme = ({ config, lib, ... }: with lib; { system.nixos.revision = mkForce null; system.nixos.versionSuffix = mkForce "pre-git"; }); in + { + nixosConfigurations = { + + nixos = inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./configuration.nix + nix-ld.nixosModules.nix-ld + + ]; + specialArgs = { inherit inputs; }; + }; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix index cfa07b9..c36dad7 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -1,20 +1,37 @@ -# these args are passed into every nixos module (or file that is in included in a nixos module imports=[...]) -{ - modulesPath, # this variable, in particular, gives us the nixos modules path for our system config - ... -}: +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: { - imports = [ - # note: this format can't be used with flakes, because it pulls from - # NIX_PATH, which is impure, and dis-allowed with flakes. - # Use the format shown in the line below it. + imports = [ ]; - # + boot.initrd.availableKernelModules = [ "ata_piix" "ohci_pci" "ehci_pci" "ahci" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; - "${modulesPath}/installer/scan/not-detected.nix" + fileSystems."/" = + { device = "/dev/disk/by-uuid/07e57f41-bbe1-4e4e-950b-9be902bc6484"; + fsType = "ext4"; + }; + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/0F7D-6BD7"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/9a725db7-d6dd-42a6-b13a-920eada1c154"; } ]; - boot.loader.systemd-boot.enable = true; # (for UEFI systems only) - fileSystems."/".device = "/dev/disk/by-label/nixos"; + + # 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 + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s3.useDHCP = lib.mkDefault true; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + virtualisation.virtualbox.guest.enable = true; }