Giter Site home page Giter Site logo

Comments (5)

KarolisL avatar KarolisL commented on August 19, 2024 1

I think that hostname -f works on both BSD (at least on Darwin) and Linux. Wouldn't that work?

from bud.

nrdxp avatar nrdxp commented on August 19, 2024

are you trying to deploy NixOS systems from darwin, or what is the usecase here? Unfortunately we still don't have great nix-darwin support in general since we don't have any MacOS users on the core team.

from bud.

blaggacao avatar blaggacao commented on August 19, 2024

The particular implementation is towards the end of:

bud/module.nix

Lines 75 to 88 in 26ba276

host =
let
partitionString = sep: s:
builtins.filter (v: builtins.isString v) (builtins.split "${sep}" s);
reversePartition = s: lib.reverseList (partitionString "\\." s);
rebake = l: builtins.concatStringsSep "." l;
in
if (hostConfig != null && hostConfig.networking.domain != null) then
rebake (reversePartition hostConfig.networking.domain + [ hostConfig.networking.hostName ])
else if hostConfig != null then
hostConfig.networking.hostName
# fall back to reverse dns from hostname --fqdn command
else "$(IFS='.'; parts=($(hostname --fqdn)); IFS=' '; HOST=$(for (( idx=\${#parts[@]}-1 ; idx>=0 ; idx-- )) ; do printf \"\${parts[idx]}.\"; done); echo \${HOST:: -1})"
;

We internally need to work with reverse DNS of the fqdn to "reliably" match hosts's to the host raking contract: nested folders are raked as reverse DNS, like so:

com
  example
    host1
    host2
net
  example
    host1
    host2

(sorry for that bash sequence)

from bud.

montchr avatar montchr commented on August 19, 2024

are you trying to deploy NixOS systems from darwin, or what is the usecase here?

@nrdxp use case is working with a flake providing an output matching my current darwin host's hostname. The flake provides a set of configurations for nix-darwin and home-manager. Essentially just dotfiles. But I'd like to reuse these profiles on NixOS systems as I build them out (via VMs or Linodes). So at least on darwin, I'd only be using the commands that aren't NixOS-specific (e.g. bud repl or bud switch if it could be used with darwin-rebuild)

@blaggacao Thanks, that points me in the right direction. I'm going to assume I'm doing something kind of wrong in the process of setting up this darwin host, as I don't think I should have ended up hitting that call to hostname at all.

from bud.

blaggacao avatar blaggacao commented on August 19, 2024

@montchr It should alwasy hit hostname unless you'd be running already from within the host that you (still) want to build.

That is: in the devshell, it should always try to figure out your current host via hostname.

Could you think of a BSD compatible implementation?

from bud.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.