commit ea3d2ee541b5d14c7671fb98927bdd357eccc3ed Author: fredrikr79 Date: Sat Jun 29 13:20:56 2024 +0200 stable system flake config diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..58f64fe --- /dev/null +++ b/configuration.nix @@ -0,0 +1,256 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + +{ config, lib, pkgs, ... }: + +let + user="fredrikr"; +in +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + #./nbfc.nix + ]; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # DUAL BOOT SETUP + #boot.kernelPackages = pkgs.linuxPackages_latest; + #boot.loader = { + # efi = { + # canTouchEfiVariables = true; + # efiSysMountPoint = "/boot"; + # }; + # grub = { + # enable = true; + # devices = ["nodev"]; + # efiSupport = true; + # useOSProber = true; + # configurationLimit = 5; + # }; + # timeout = 3; + #}; + + 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. + + # Set your time zone. + time.timeZone = "Europe/Oslo"; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_MESSAGES = "en_US.UTF-8"; + LC_TIME = "nb_NO.UTF-8"; + LC_MONETARY = "nb_NO.UTF-8"; + }; + console = { + font = "Lat2-Terminus16"; + # keyMap = "us"; + # useXkbConfig = true; # use xkb.options in tty. + }; + + + # TTY settings + i18n = { + # luckily this also changes the keyboard layout at boot (for e.g full disk encryption passwords) + consoleKeyMap = "dvorak-programmer"; + }; + + # GUI settings, this includes login screen + #services.xserver.layout = "us"; + #services.xserver.xkbVariant = "dvp"; + #services.xserver.xkbOptions = "eurosign:e"; + + + # Configure keymap in X11 + # services.xserver.xkb.layout = "us"; + # services.xserver.xkb.options = "eurosign:e,caps:escape"; + + + # Enable the X11 windowing system. + services.autorandr.enable = true; + services.xserver = { + enable = true; + autorun = true; + + # DVORAK + NO + layout = "us,no"; + xkbVariant = "dvp,"; + xkbOptions = "compose:menu, grp:alt_shift_toggle"; + + windowManager = { + xmonad = { + enable = true; + enableContribAndExtras = true; + extraPackages = hpkgs: [ + hpkgs.xmobar + # hpkgs.xmonad_0_17_0 + # hpkgs.xmonad-contrib_0_17_0 + # hpkgs.xmonad-extras_0_17_0 + # hpkgs.xmonad-screenshot + ]; + }; + }; + displayManager = { + defaultSession = "none+xmonad"; + lightdm = { + greeters.enso = { + enable = true; + blur = true; + extraConfig = '' + default-wallpaper=/usr/share/nix.png + ''; + }; + }; + # sessionCommands = '' ''; + }; + }; + + + # Enable CUPS to print documents. + # services.printing.enable = true; + + # Enable sound. + sound = { + enable = true; + mediaKeys.enable = true; + }; + hardware.pulseaudio.enable = true; + # OR + # services.pipewire = { + # enable = true; + # pulse.enable = true; + # }; + + # Enable touchpad support (enabled default in most desktopManager). + services.libinput.enable = true; + + hardware.bluetooth = { + enable = true; + hsphfpd.enable = true; + settings = { + General = { + Enable = "Source,Sink,Media,Socket"; + }; + }; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.${user} = { + isNormalUser = true; + extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + initialPassword = "password"; + packages = with pkgs; [ # managed by home-manager + firefox + discord + #tree + ]; + shell = pkgs.zsh; + }; + + programs.zsh.enable = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = (with pkgs; [ + vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + xorg.xkill + haskellPackages.xmobar + feh + trayer + # htop + ]); + + programs.steam.enable = true; + + nixpkgs.config.allowUnfree = true; + + # 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 option defines the first version of NixOS you have installed on this particular machine, + # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. + # + # Most users should NEVER change this value after the initial install, for any reason, + # even if you've upgraded your system to a new NixOS release. + # + # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, + # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how + # to actually do that. + # + # This value being lower than the current NixOS release does NOT mean your system is + # out of date, out of support, or vulnerable. + # + # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, + # and migrated your data accordingly. + # + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "24.05"; # Did you read the comment? + + # OVERLAYS + + nixpkgs.overlays = [ + (self: super: { + discord = super.discord.overrideAttrs ( + _: { src = builtins.fetchTarball { + url = "https://discord.com/api/download?platform=linux&format=tar.gz"; + sha256 = "0k9sk5pmjw7xq68h2s80q8fg48p31albrqrqafmmrxik5f8f96rn"; + }; } + ); + }) + ]; + + nix = { + package = pkgs.nixFlakes; + extraOptions = "experimental-features = nix-command flakes"; + }; + + services.picom.enable = true; + + # systemd.services.background-image = { + # wantedBy = [ "multi-user.target" ]; + # enable = true; + # serviceConfig = { + # User = "root"; + # Group = "root"; + # Type = "oneshot"; + # # ExecStart = "~/.fehbg"; + # }; + # script = "/home/fredrikr/.fehbg &"; + # }; + +} + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..266d62f --- /dev/null +++ b/flake.lock @@ -0,0 +1,297 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717408969, + "narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=", + "owner": "numtide", + "repo": "devshell", + "rev": "1ebbe68d57457c8cae98145410b164b5477761f4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-compat": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat_2", + "gitignore": "gitignore", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719259945, + "narHash": "sha256-F1h+XIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixvim", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1718530513, + "narHash": "sha256-BmO8d0r+BVlwWtMLQEYnwmngqdXIuyFzMwvmTcLMee8=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "a1fddf0967c33754271761d91a3d921772b30d0e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.05", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1718530513, + "narHash": "sha256-BmO8d0r+BVlwWtMLQEYnwmngqdXIuyFzMwvmTcLMee8=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "a1fddf0967c33754271761d91a3d921772b30d0e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.05", + "repo": "home-manager", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719128254, + "narHash": "sha256-I7jMpq0CAOZA/i70+HDQO/ulLttyQu/K70cSESiMX7A=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "50581970f37f06a4719001735828519925ef8310", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1719253556, + "narHash": "sha256-A/76RFUVxZ/7Y8+OMVL1Lc8LRhBxZ8ZE2bpMnvZ1VpY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "fc07dc3bdf2956ddd64f24612ea7fc894933eb2e", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "devshell": "devshell", + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "git-hooks": "git-hooks", + "home-manager": "home-manager_2", + "nix-darwin": "nix-darwin", + "nixpkgs": [ + "nixpkgs" + ], + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1719379679, + "narHash": "sha256-Al7iFQD8rzU4X8wDKh7eAJfNcFmO3cVZt43oCVyYfoQ=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "a8c99bc62848ad0c850f585f2fd7dae0041d2cb1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "nixos-24.05", + "repo": "nixvim", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nixvim": "nixvim" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719243788, + "narHash": "sha256-9T9mSY35EZSM1KAwb7K9zwQ78qTlLjosZgtUGnw4rn4=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "065a23edceff48f948816b795ea8cc6c0dee7cdf", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..204c4e3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,63 @@ +{ + description = "A very basic flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + + home-manager = { + url = github:nix-community/home-manager/release-24.05; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + #nbfc-linux = { + #url = "github:nbfc-linux/nbfc-linux"; + #inputs.nixpkgs.follows = "nixpkgs"; + #}; + + nixvim = { + url = "github:nix-community/nixvim/nixos-24.05"; + # If using a stable channel you can use `url = "github:nix-community/nixvim/nixos-"` + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, home-manager, nixvim, ... } @ inputs: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + lib = nixpkgs.lib; + in + { + nixosConfigurations = { + #nixos = lib.nixosSystem { + #inherit system; + #specialArgs = {inherit inputs;}; + #modules = [ + #./configuration.nix + #]; + #}; + + fredrikr = lib.nixosSystem { + inherit system; + specialArgs = {inherit inputs;}; + modules = [ + ./configuration.nix + + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.fredrikr = { + imports = [ ./home.nix + nixvim.homeManagerModules.nixvim + ]; + }; + } + ]; + }; + + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..2319712 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,41 @@ +# 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 = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "vmd" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-label/boot"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-label/swap"; } + ]; + + # 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.enp1s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..e869472 --- /dev/null +++ b/home.nix @@ -0,0 +1,259 @@ +{ config, pkgs, ... }: + +{ + home.username = "fredrikr"; + home.homeDirectory = "/home/fredrikr"; + + home.stateVersion = "24.05"; # Please read the comment before changing. + + home.packages = with pkgs; [ + htop + dmenu + alacritty + # discord + # firefox + scrot + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + }; + + home.sessionVariables = { + EDITOR = "nvim"; + }; + + programs.home-manager.enable = true; + + programs.nixvim = { + enable = true; + defaultEditor = true; + + keymaps = [ + { + key = "jk"; + action = ""; + mode = [ "i" ]; + options = { + noremap = true; + }; + } + + { + key = "pv"; + action = ":Ex"; + mode = [ "n" ]; + } + + { + key = "n"; + action = "nzzzv"; + mode = [ "n" ]; + } + + { + key = "N"; + action = "Nzzzv"; + mode = [ "n" ]; + } + + { + key = "u"; + action = ":UndotreeToggle"; + mode = [ "n" ]; + } + ]; + + colorschemes.nord = { + enable = true; + settings = { + disable_background = true; + }; + }; + + viAlias = true; + vimAlias = true; + + globals = { + mapleader = " "; + }; + + opts = { + termguicolors = true; + + number = true; + + tabstop = 4; + softtabstop = 4; + shiftwidth = 4; + expandtab = true; + smartindent = true; + + swapfile = false; + backup = false; + undofile = true; + + hlsearch = false; + incsearch = true; + + scrolloff = 8; + + signcolumn = "yes"; + + updatetime = 50; + + colorcolumn = "80"; + + ignorecase = true; + smartcase = true; + }; + + plugins = { + coq-nvim.enable = true; + + cmp = { + enable = true; + settings = { + autoEnableSources = true; + experimental = {ghost_text = true;}; + performance = { + debounce = 60; + fetchingTimeout = 200; + maxViewEntries = 30; + }; + snippet = {expand = "luasnip";}; + formatting = {fields = ["kind" "abbr" "menu"];}; + sources = [ + {name = "git";} + {name = "nvim_lsp";} + {name = "emoji";} + { + name = "buffer"; # text within current buffer + option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; + keywordLength = 3; + } + { + name = "path"; # file system paths + keywordLength = 3; + } + { + name = "luasnip"; # snippets + keywordLength = 3; + } + ]; + + window = { + completion = {border = "solid";}; + documentation = {border = "solid";}; + }; + + mapping = { + "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.abort()"; + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.confirm({ select = true })"; + "" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })"; + }; + }; + }; + + cmp-nvim-lsp = {enable = true;}; # lsp + cmp-buffer = {enable = true;}; + cmp-path = {enable = true;}; # file system paths + cmp_luasnip = {enable = true;}; # snippets + cmp-cmdline = {enable = false;}; # autocomplete for cmdline + + lsp = { + enable = true; + keymaps = { + diagnostic = { + "j" = "goto_next"; + "k" = "goto_prev"; + "e" = "open_float"; + }; + lspBuf = { + K = "hover"; + gD = "references"; + gd = "definition"; + gi = "implementation"; + gt = "type_definition"; + }; + }; + servers = { + pylsp.enable = true; + nil-ls.enable = true; + lua-ls.enable = true; + hls.enable = true; + }; + }; + + friendly-snippets.enable = true; + luasnip.enable = true; + + harpoon = { + enable = true; + keymaps = { + navFile = { + "1" = ""; + "2" = ""; + "3" = ""; + "4" = ""; + }; + addFile = "ha"; + toggleQuickMenu = "hl"; + }; + }; + + treesitter.enable = true; + + undotree.enable = true; + + comment.enable = true; + surround.enable = true; + + presence-nvim.enable = true; + + which-key.enable = true; + }; + }; + + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + autocd = true; + + history = { + size = 10000; + path = "${config.xdg.dataHome}/zsh/history"; + }; + + oh-my-zsh = { + enable = true; + plugins = [ "git" "shrink-path" ]; + theme = "lambda"; + }; + }; + + programs.git = { + enable = true; + userName = "fredrikr79"; + userEmail = "fredrikrobertsen7@gmail.com"; + }; +} diff --git a/nbfc.nix b/nbfc.nix new file mode 100644 index 0000000..5c658a1 --- /dev/null +++ b/nbfc.nix @@ -0,0 +1,23 @@ +# nbfc.nix +{ + config, + inputs, + pkgs, + ... +}: let + myUser = "fredrikr"; #adjust this to your username + command = "bin/nbfc_service --config-file '/home/${myUser}/.config/nbfc.json'"; + +in { + environment.systemPackages = with pkgs; [ + inputs.nbfc-linux.packages.x86_64-linux.default + ]; + systemd.services.nbfc_service = { + enable = true; + description = "NoteBook FanControl service"; + serviceConfig.Type = "simple"; + path = [pkgs.kmod]; + script = "${inputs.nbfc-linux.packages.x86_64-linux.default}/${command}"; + wantedBy = ["multi-user.target"]; + }; +}