Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { config, lib, pkgs, ... }:
- let
- hostName = config.networking.hostName;
- ifDesktop = val:
- if (__any (x: x == hostName) [ "jmdesk" "jmlap" ]) then val else empty val;
- ifHost = host: val:
- if hostName == host then val else empty val;
- empty = val:
- if __isList val then [] else if __isAttrs val then {} else false;
- dirhome = config.users.extraUsers.joelmo.home;
- dirdocuments = "${dirhome}/Documents";
- in {
- imports = [
- <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
- /home/joelmo/Documents/musnix
- ];
- config = {
- boot = {
- kernelParams = [ "elevator=noop" ];
- tmpOnTmpfs = true;
- };
- environment = {
- etc."nixos/configuration.nix".source = "/home/joelmo/.nixpkgs/${hostName}.nix";
- systemPackages = with pkgs; [ fuse fuse_exfat ];
- };
- nix = {
- maxJobs = 4;
- readOnlyStore = false;
- requireSignedBinaryCaches = false;
- # useChroot = true;
- # sshServe.enable = true;
- # sshServe.keys = [ (__readFile ${dirdocuments}/configurations/jmlap_id_rsa.pub) ];
- };
- i18n.consoleKeyMap = "uk";
- nixpkgs.config.allowUnfree = true;
- hardware = {
- cpu.intel.updateMicrocode = true;
- enableAllFirmware = true;
- } // ifDesktop {
- pulseaudio.enable = true;
- pulseaudio.package = pkgs.pulseaudioFull;
- opengl.driSupport32Bit = true;
- opengl.extraPackages = with pkgs; [ vaapiIntel ];
- };
- musnix.enable = ifDesktop true;
- networking = {
- firewall.enable = false;
- networkmanager.enable = ifDesktop true;
- };
- powerManagement.enable = true;
- services = {
- avahi.enable = true;
- avahi.nssmdns = true;
- avahi.browseDomains = [];
- avahi.publish.addresses = true;
- avahi.publish.enable = true;
- openssh.enable = true;
- } // ifDesktop {
- acpid.enable = true;
- locate.enable = true;
- locate.includeStore = true;
- locate.localuser = "root";
- upower.enable = true;
- printing.enable = true;
- # virtualboxHost.enable = true;
- xserver = {
- displayManager.sddm.enable = true;
- desktopManager.kde5.enable = true;
- useGlamor = true;
- enable = true;
- layout = "gb,se";
- };
- };
- sound.enableOSSEmulation = false;
- time.timeZone = "Europe/Stockholm";
- users.extraUsers.joelmo = {
- extraGroups = [ "wheel" ] ++ ifDesktop [ "networkmanager" "audio" ];
- isNormalUser = true;
- password = "zxc";
- uid = 1000;
- };
- users.extraUsers.demo = {
- isNormalUser = true;
- extraGroups = [ "networkmanager" ];
- password = "demo";
- };
- systemd.user.services.ipython =
- with pkgs;
- with python27Packages; {
- wantedBy = [ "default.target" ];
- path = [ bash openssh notebook ipython "/home/joelmo/.nix-profile" ];
- environment = let suffix = python27.sitePackages; in {
- PYTHONPATH = "/home/joelmo/.nix-profile/${suffix}"
- + ":/home/joelmo/.local/${suffix}";
- SSH_AUTH_SOCK = "/run/user/1000/ssh-agent";
- };
- serviceConfig = {
- ExecStart = "${pkgs.python27Packages.notebook}/bin/jupyter-notebook ${dirdocuments}";
- CPUSchedulingPolicy = "batch";
- };
- };
- systemd.user.services.syncthing = {
- wantedBy = [ "default.target" ];
- path = [ pkgs.syncthing ];
- environment = {
- STNOUPGRADE = "yes";
- STNORESTART = "yes";
- };
- serviceConfig = {
- ExecStart = "${pkgs.syncthing}/bin/syncthing -home ${dirhome}/.config/syncthing -logflags=0 -no-browser";
- CPUSchedulingPolicy = "batch";
- IOSchedulingClass = "idle";
- PermissionsStartOnly = true;
- Restart = "on-failure";
- SuccessExitStatus = "2 3 4";
- RestartForceExitStatus="3 4";
- };
- };
- systemd.user.services.news = {
- path = with pkgs; [ rawdog ];
- serviceConfig = {
- ExecStart = "/home/joelmo/bin/news.sh";
- CPUSchedulingPolicy = "batch";
- };
- };
- systemd.user.services.backup = {
- path = with pkgs; [ duplicity megatools ];
- serviceConfig = {
- ExecStart = "/home/joelmo/bin/backup.sh";
- };
- };
- systemd.user.timers = ifHost "jmdesk" {
- backup = {
- wantedBy = [ "default.target" ];
- timerConfig = {
- OnCalendar = "*-*-* 22:00:00";
- Persistent = "true";
- WakeSystem = "true";
- };
- };
- news = {
- wantedBy = [ "default.target" ];
- timerConfig = {
- OnCalendar = "*-*-* 18:00:00";
- Persistent = "true";
- WakeSystem = "true";
- };
- };
- };
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement