From 210a1f4592a8377397fc45df917b48ea245092f7 Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Sat, 15 Feb 2020 20:26:30 +0100 Subject: [PATCH] Commit nix stuff --- default.nix | 17 ++++++------ vm.nix | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 9 deletions(-) create mode 100644 vm.nix diff --git a/default.nix b/default.nix index ea13f34..08251b4 100644 --- a/default.nix +++ b/default.nix @@ -1,26 +1,25 @@ -# { system ? builtins.currentSystem }: { sources ? import ./nix/sources.nix , pkgs ? import sources.nixpkgs { } , callPackage ? pkgs.callPackage }: let - cargoNix = callPackage ./Cargo.nix { }; + cargoNix = callPackage ./Cargo.nix { + # defaultCrateOverrides = pkgs.defaultCrateOverrides // { + # libgit2-sys = attrs: { + # buildInputs = [ pkgs.openssl ]; + # }; + # }; + }; hoc = cargoNix.rootCrate.build; - - buildInputs = [ pkgs.openssl pkgs.cacert ]; - - # version = hoc.version; - -# in hoc.rootCrate.build in pkgs.symlinkJoin { name = hoc.name; version = hoc.crateVersion; paths = [ hoc ]; - buildInputs = [ pkgs.openssl pkgs.cacert ]; + # buildInputs = [ pkgs.openssl pkgs.cacert ]; postBuild = '' rm -rf $out/bin/hoc.d diff --git a/vm.nix b/vm.nix new file mode 100644 index 0000000..5892d20 --- /dev/null +++ b/vm.nix @@ -0,0 +1,80 @@ +# Nix configuration for a VM to run a custom configured Vim +# +# It is intended as an example of building a VM that builds Vim for testing +# and evaluation purposes. It does not represent a production or secure +# deployment. + +{ sources ? import ./nix/sources.nix +, pkgs ? import sources.nixpkgs { } +, callPackage ? pkgs.callPackage +, config +, lib +, ... +}: + # config, pkgs, lib, ... }: + +let + hoc = pkgs.callPackage ./default.nix { }; + + # hoc = cargoNix.rootCrate.build; +in +{ + environment = { + systemPackages = with pkgs; [ + ( + hoc + # import ./default.nix + ) + ]; + }; + + + networking.hostName = "hoc"; # Define your hostname. + + system.stateVersion = "19.09"; # The version of NixOS originally installed + + # Set security options: + security = { + sudo = { + enable = true; # Enable sudo + wheelNeedsPassword = false; # Allow wheel members to run sudo without a passowrd + }; + }; + + networking.firewall.allowedTCPPorts = [ 80 ]; + + # List services that you want to enable: + services.openssh = { + enable = true; # Enable the OpenSSH daemon. + #permitRootLogin = "yes"; # Probably want to change this in production + #challengeResponseAuthentication = true; # Probably want to change this in production + #passwordAuthentication = true; # Probably want to change this in production + openFirewall = true; + hostKeys = [ + { + path = "/etc/ssh/ssh_host_ed25519_key"; # Generate a key for the vm + type = "ed25519"; # Use the current best key type + } + ]; + }; + + # Users of the Vim VM: + users.mutableUsers = false; # Remove any users not defined in here + + users.users.root = { + password = "123456"; # Probably want to change this in production + }; + + # Misc groups: + users.groups.nixos.gid = 1000; + + # NixOS users + users.users.nixos = { + isNormalUser = true; + uid = 1000; + group = "nixos"; + extraGroups = [ "wheel" ]; + password = "123456"; # Probably want to change this in production + }; + +}