Commit nix stuff

This commit is contained in:
Valentin Brandl 2020-02-15 20:26:30 +01:00
parent 3708768f34
commit 210a1f4592
No known key found for this signature in database
GPG Key ID: 30D341DD34118D7D
2 changed files with 88 additions and 9 deletions

View File

@ -1,26 +1,25 @@
# { system ? builtins.currentSystem }:
{ sources ? import ./nix/sources.nix { sources ? import ./nix/sources.nix
, pkgs ? import sources.nixpkgs { } , pkgs ? import sources.nixpkgs { }
, callPackage ? pkgs.callPackage , callPackage ? pkgs.callPackage
}: }:
let let
cargoNix = callPackage ./Cargo.nix { }; cargoNix = callPackage ./Cargo.nix {
# defaultCrateOverrides = pkgs.defaultCrateOverrides // {
# libgit2-sys = attrs: {
# buildInputs = [ pkgs.openssl ];
# };
# };
};
hoc = cargoNix.rootCrate.build; hoc = cargoNix.rootCrate.build;
buildInputs = [ pkgs.openssl pkgs.cacert ];
# version = hoc.version;
# in hoc.rootCrate.build
in in
pkgs.symlinkJoin { pkgs.symlinkJoin {
name = hoc.name; name = hoc.name;
version = hoc.crateVersion; version = hoc.crateVersion;
paths = [ hoc ]; paths = [ hoc ];
buildInputs = [ pkgs.openssl pkgs.cacert ]; # buildInputs = [ pkgs.openssl pkgs.cacert ];
postBuild = '' postBuild = ''
rm -rf $out/bin/hoc.d rm -rf $out/bin/hoc.d

80
vm.nix Normal file
View File

@ -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
};
}